[llvm] bb2e9f2 - [TableGen] Call std::vector::reserve to preallocate memory before a loop of push_back. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 11 00:11:29 PDT 2023
Author: Craig Topper
Date: 2023-04-11T00:07:57-07:00
New Revision: bb2e9f23ca266843d58f71e019be1fe7cae0fea5
URL: https://github.com/llvm/llvm-project/commit/bb2e9f23ca266843d58f71e019be1fe7cae0fea5
DIFF: https://github.com/llvm/llvm-project/commit/bb2e9f23ca266843d58f71e019be1fe7cae0fea5.diff
LOG: [TableGen] Call std::vector::reserve to preallocate memory before a loop of push_back. NFC
Added:
Modified:
llvm/utils/TableGen/CodeGenDAGPatterns.cpp
Removed:
################################################################################
diff --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index d4f87d2779ce..3d2883c1cdf6 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -2116,6 +2116,7 @@ void TreePatternNode::InlinePatternFragments(
do {
// Create the variant and add it to the output list.
std::vector<TreePatternNodePtr> NewChildren;
+ NewChildren.reserve(ChildAlternatives.size());
for (unsigned i = 0, e = ChildAlternatives.size(); i != e; ++i)
NewChildren.push_back(ChildAlternatives[i][Idxs[i]]);
TreePatternNodePtr R = std::make_shared<TreePatternNode>(
More information about the llvm-commits
mailing list