[PATCH] D100691: [TableGen] Store predicates in PatternToMatch as ListInit *. Add string for HwModeFeatures

Paul C. Anagnostopoulos via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 17 10:40:36 PDT 2021


Paul-C-Anagnostopoulos added inline comments.


================
Comment at: llvm/utils/TableGen/CodeGenDAGPatterns.cpp:1477
+    PredicateCheck += HwModeFeatures;
+    PredicateCheck += "\"))";
   }
----------------
craig.topper wrote:
> Paul-C-Anagnostopoulos wrote:
> > Any reason you didn't combine the catenations with '+' ?
> Concatenating them would produce a temporary std::string that would need a heap allocation. That would then need to be copied into the SmallString. If the total string is small enough the SmallString won't heap allocate. If we copy each piece in separately we avoid heap allocations for temporaries.
Sounds like there's room for an optimization that looks at the complete sequence of catenations to decide whether there is room in the SmallString. But good to know.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100691/new/

https://reviews.llvm.org/D100691



More information about the llvm-commits mailing list