[llvm] [NFC] Replace `GetPatFromTreePatternNode` with `llvm::to_string` (PR #123754)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 06:54:09 PST 2025


================
@@ -941,10 +935,8 @@ unsigned MatcherTableEmitter::EmitMatcher(const Matcher *N,
       if (const MorphNodeToMatcher *SNT = dyn_cast<MorphNodeToMatcher>(N)) {
         NumCoveredBytes = 3;
         OS << "OPC_Coverage, ";
-        std::string src =
-            GetPatFromTreePatternNode(SNT->getPattern().getSrcPattern());
-        std::string dst =
-            GetPatFromTreePatternNode(SNT->getPattern().getDstPattern());
+        std::string src = to_string(SNT->getPattern().getSrcPattern());
+        std::string dst = to_string(SNT->getPattern().getDstPattern());
----------------
arsenm wrote:

this is building one string in 3 parts. Why not have the one raw_stream_ostream, and build the whole thing at once with src, the -> and the dst 

https://github.com/llvm/llvm-project/pull/123754


More information about the llvm-commits mailing list