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

Tomas Matheson via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 07:14:32 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());
----------------
tmatheson-arm wrote:

I guess `to_string` reads better, and I didn't consider the performance important. If you think it matters I can change it.

The motivation for replacing `GetPatFromTreePatternNode` is just that I'm going to change one of the types and it seemed better to use a generic `to_string` rather than introducing a new `GetPatFromTreePatternNode` equivalent.

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


More information about the llvm-commits mailing list