summaryrefslogtreecommitdiff
path: root/lib/VMCore/Type.cpp
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-02-07 01:27:51 +0000
committerBill Wendling <isanbard@gmail.com>2012-02-07 01:27:51 +0000
commita7a3f04eb9a18c11940ab1486709c63c8bd296ff (patch)
tree21d732baf3a75e2e893fef2dacd1d589b50f3838 /lib/VMCore/Type.cpp
parenteb446511ce5f1761962f12f1e8a0c7b342733d1c (diff)
downloadllvm-a7a3f04eb9a18c11940ab1486709c63c8bd296ff.tar.gz
llvm-a7a3f04eb9a18c11940ab1486709c63c8bd296ff.tar.bz2
llvm-a7a3f04eb9a18c11940ab1486709c63c8bd296ff.tar.xz
Reserve space in these vectors to prevent having to grow the array too
much. This gets us an addition 0.9% on 445.gobmk. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149952 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Type.cpp')
-rw-r--r--lib/VMCore/Type.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp
index f5c88ccd38..14a5aae70f 100644
--- a/lib/VMCore/Type.cpp
+++ b/lib/VMCore/Type.cpp
@@ -440,11 +440,12 @@ bool FunctionType::isValidArgumentType(Type *ArgTy) {
StructType *StructType::get(LLVMContext &Context, ArrayRef<Type*> ETypes,
bool isPacked) {
// FIXME: std::vector is horribly inefficient for this probe.
- std::vector<Type*> Key;
- for (unsigned i = 0, e = ETypes.size(); i != e; ++i) {
+ unsigned ETypesSize = ETypes.size();
+ std::vector<Type*> Key(ETypesSize);
+ for (unsigned i = 0, e = ETypesSize; i != e; ++i) {
assert(isValidElementType(ETypes[i]) &&
"Invalid type for structure element!");
- Key.push_back(ETypes[i]);
+ Key[i] = ETypes[i];
}
if (isPacked)
Key.push_back(0);