aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/ConstantFold.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-02-17 15:29:18 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-02-17 15:29:18 +0000
commit6cd780ff2143656df213359b7a6df9a5a9237e17 (patch)
treeb3689d2b8496e1cc569d85b5c59b0ac1d68beace /llvm/lib/IR/ConstantFold.cpp
parent2ba8778157390981ba1e4a3b683aee09aa9f009f (diff)
downloadllvm-6cd780ff2143656df213359b7a6df9a5a9237e17.zip
llvm-6cd780ff2143656df213359b7a6df9a5a9237e17.tar.gz
llvm-6cd780ff2143656df213359b7a6df9a5a9237e17.tar.bz2
Prefer SmallVector::append/insert over push_back loops.
Same functionality, but hoists the vector growth out of the loop. llvm-svn: 229500
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r--llvm/lib/IR/ConstantFold.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 16ecf1c..a915d28 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -2079,8 +2079,7 @@ static Constant *ConstantFoldGetElementPtrImpl(Constant *C,
if (PerformFold) {
SmallVector<Value*, 16> NewIndices;
NewIndices.reserve(Idxs.size() + CE->getNumOperands());
- for (unsigned i = 1, e = CE->getNumOperands()-1; i != e; ++i)
- NewIndices.push_back(CE->getOperand(i));
+ NewIndices.append(CE->op_begin() + 1, CE->op_end() - 1);
// Add the last index of the source with the first index of the new GEP.
// Make sure to handle the case when they are actually different types.