Skip to content

Commit

Permalink
Eliminate a temporary std::vector in ConstantStruct::get().
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133612 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
jayfoad committed Jun 22, 2011
1 parent 2a4a6fe commit 0df445b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/VMCore/Constants.cpp
Expand Up @@ -666,10 +666,8 @@ Constant *ConstantStruct::get(const StructType *ST, ArrayRef<Constant*> V) {

// Create a ConstantAggregateZero value if all elements are zeros.
for (unsigned i = 0, e = V.size(); i != e; ++i)
if (!V[i]->isNullValue()) {
// FIXME: Eliminate temporary std::vector here!
return ST->getContext().pImpl->StructConstants.getOrCreate(ST, V.vec());
}
if (!V[i]->isNullValue())
return ST->getContext().pImpl->StructConstants.getOrCreate(ST, V);

return ConstantAggregateZero::get(ST);
}
Expand Down

0 comments on commit 0df445b

Please sign in to comment.