[llvm] [NFC] Reserve the number of operands before push_back (PR #106234)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 27 07:57:40 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: Nabeel Omer (omern1)
<details>
<summary>Changes</summary>
Partially addresses #<!-- -->105836
---
Full diff: https://github.com/llvm/llvm-project/pull/106234.diff
1 Files Affected:
- (modified) llvm/lib/IR/ConstantsContext.h (+1)
``````````diff
diff --git a/llvm/lib/IR/ConstantsContext.h b/llvm/lib/IR/ConstantsContext.h
index 2d12723a2329df..acf05379e8a2a6 100644
--- a/llvm/lib/IR/ConstantsContext.h
+++ b/llvm/lib/IR/ConstantsContext.h
@@ -292,6 +292,7 @@ template <class ConstantClass> struct ConstantAggrKeyType {
ConstantAggrKeyType(const ConstantClass *C,
SmallVectorImpl<Constant *> &Storage) {
assert(Storage.empty() && "Expected empty storage");
+ Storage.reserve(C->getNumOperands());
for (unsigned I = 0, E = C->getNumOperands(); I != E; ++I)
Storage.push_back(C->getOperand(I));
Operands = Storage;
``````````
</details>
https://github.com/llvm/llvm-project/pull/106234
More information about the llvm-commits
mailing list