[llvm] [NFC] Reserve the number of operands before push_back (PR #106234)
Nabeel Omer via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 27 07:57:06 PDT 2024
https://github.com/omern1 created https://github.com/llvm/llvm-project/pull/106234
Partially addresses #105836
>From 9a6a3fa05808347b2b030ab9a592ebb612262d31 Mon Sep 17 00:00:00 2001
From: Nabeel Omer <Nabeel.Omer at sony.com>
Date: Tue, 27 Aug 2024 15:44:56 +0100
Subject: [PATCH] [NFC] Reserve the number of operands before push_back
Partially addresses #105836
---
llvm/lib/IR/ConstantsContext.h | 1 +
1 file changed, 1 insertion(+)
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;
More information about the llvm-commits
mailing list