[PATCH] D100691: [TableGen] Store predicates in PatternToMatch as ListInit *. Add string for HwModeFeatures
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 17 10:07:58 PDT 2021
craig.topper added a comment.
In D100691#2696632 <https://reviews.llvm.org/D100691#2696632>, @Paul-C-Anagnostopoulos wrote:
> I presume this passes all the TableGen tests.
>
> How else did you test it? Knowing this may help me in the future.
All output files for all targets are identical before and after this patch.
================
Comment at: llvm/utils/TableGen/CodeGenDAGPatterns.cpp:1436
+SmallVector<Record *, 4> PatternToMatch::getPredicateRecords() const {
+ SmallVector<Record *, 4> PredicateRecs;
----------------
Paul-C-Anagnostopoulos wrote:
> No need to mention initial size ", 4" in the function definition, is there?
I think it's needed because I'm returning the vector object, not a reference. Maybe I should make the caller pass it by reference.
================
Comment at: llvm/utils/TableGen/CodeGenDAGPatterns.cpp:1477
+ PredicateCheck += HwModeFeatures;
+ PredicateCheck += "\"))";
}
----------------
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.
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