[llvm] b5e3a57 - [TableGen] Use emplace_back to add to PatternsToMatch in GenerateVariants. Use std::move when adding to PatternsToMatch in AddPatternToMatch.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 30 13:27:17 PST 2021
Author: Craig Topper
Date: 2021-01-30T13:16:39-08:00
New Revision: b5e3a5785dab0d0c7aa68cc65c2dd348488e72d1
URL: https://github.com/llvm/llvm-project/commit/b5e3a5785dab0d0c7aa68cc65c2dd348488e72d1
DIFF: https://github.com/llvm/llvm-project/commit/b5e3a5785dab0d0c7aa68cc65c2dd348488e72d1.diff
LOG: [TableGen] Use emplace_back to add to PatternsToMatch in GenerateVariants. Use std::move when adding to PatternsToMatch in AddPatternToMatch.
We already used emplace_back in at least one other place so be
consistent.
AddPatternToMatch already took PTM as an rvalue reference, but
we need to use std::move again to move it into the PatternToMatch
vector.
Added:
Modified:
llvm/utils/TableGen/CodeGenDAGPatterns.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index d4409db2837e..52c47f5e514b 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -3958,7 +3958,7 @@ void CodeGenDAGPatterns::AddPatternToMatch(TreePattern *Pattern,
SrcNames[Entry.first].second == 1)
Pattern->error("Pattern has dead named input: $" + Entry.first);
- PatternsToMatch.push_back(PTM);
+ PatternsToMatch.push_back(std::move(PTM));
}
void CodeGenDAGPatterns::InferInstructionFlags() {
@@ -4719,11 +4719,11 @@ void CodeGenDAGPatterns::GenerateVariants() {
if (AlreadyExists) continue;
// Otherwise, add it to the list of patterns we have.
- PatternsToMatch.push_back(PatternToMatch(
+ PatternsToMatch.emplace_back(
PatternsToMatch[i].getSrcRecord(), PatternsToMatch[i].getPredicates(),
Variant, PatternsToMatch[i].getDstPatternShared(),
PatternsToMatch[i].getDstRegs(),
- PatternsToMatch[i].getAddedComplexity(), Record::getNewUID()));
+ PatternsToMatch[i].getAddedComplexity(), Record::getNewUID());
MatchedPredicates.push_back(Matches);
// Add a new match the same as this pattern.
More information about the llvm-commits
mailing list