diff options
author | Bill Wendling <isanbard@gmail.com> | 2012-02-07 01:27:51 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2012-02-07 01:27:51 +0000 |
commit | 3ae7dd377d36117806e90b2bd929415cafd5dc5e (patch) | |
tree | 8cc6db8d41b5af4e6e5c00ff88bbb61a20b42fc2 /llvm/lib/VMCore/Constants.cpp | |
parent | 7ecbd32e4ee21ca01100287bd604f83308e894e7 (diff) | |
download | bcm5719-llvm-3ae7dd377d36117806e90b2bd929415cafd5dc5e.tar.gz bcm5719-llvm-3ae7dd377d36117806e90b2bd929415cafd5dc5e.zip |
Reserve space in these vectors to prevent having to grow the array too
much. This gets us an addition 0.9% on 445.gobmk.
llvm-svn: 149952
Diffstat (limited to 'llvm/lib/VMCore/Constants.cpp')
-rw-r--r-- | llvm/lib/VMCore/Constants.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp index a2f3b3f0b32..6dbc1449f24 100644 --- a/llvm/lib/VMCore/Constants.cpp +++ b/llvm/lib/VMCore/Constants.cpp @@ -784,9 +784,10 @@ Constant *ConstantArray::get(ArrayType *Ty, ArrayRef<Constant*> V) { StructType *ConstantStruct::getTypeForElements(LLVMContext &Context, ArrayRef<Constant*> V, bool Packed) { - SmallVector<Type*, 16> EltTypes; - for (unsigned i = 0, e = V.size(); i != e; ++i) - EltTypes.push_back(V[i]->getType()); + unsigned VecSize = V.size(); + SmallVector<Type*, 16> EltTypes(VecSize); + for (unsigned i = 0; i != VecSize; ++i) + EltTypes[i] = V[i]->getType(); return StructType::get(Context, EltTypes, Packed); } |