[llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp SimplifyLibCalls.cpp
Chris Lattner
sabre at nondot.org
Wed Jan 31 12:00:11 PST 2007
Changes in directory llvm/lib/Transforms/IPO:
GlobalOpt.cpp updated: 1.92 -> 1.93
SimplifyLibCalls.cpp updated: 1.90 -> 1.91
---
Log message:
eliminate temporary vectors
---
Diffs of the changes: (+8 -12)
GlobalOpt.cpp | 11 +++++------
SimplifyLibCalls.cpp | 9 +++------
2 files changed, 8 insertions(+), 12 deletions(-)
Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.92 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.93
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.92 Tue Jan 30 22:40:53 2007
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Wed Jan 31 13:59:55 2007
@@ -452,11 +452,11 @@
&Idxs[0], Idxs.size());
} else {
GetElementPtrInst *GEPI = cast<GetElementPtrInst>(GEP);
- std::vector<Value*> Idxs;
+ SmallVector<Value*, 8> Idxs;
Idxs.push_back(NullInt);
for (unsigned i = 3, e = GEPI->getNumOperands(); i != e; ++i)
Idxs.push_back(GEPI->getOperand(i));
- NewPtr = new GetElementPtrInst(NewPtr, Idxs,
+ NewPtr = new GetElementPtrInst(NewPtr, &Idxs[0], Idxs.size(),
GEPI->getName()+"."+utostr(Val), GEPI);
}
GEP->replaceAllUsesWith(NewPtr);
@@ -684,10 +684,9 @@
MallocInst *NewMI =
new MallocInst(NewTy, Constant::getNullValue(Type::Int32Ty),
MI->getAlignment(), MI->getName(), MI);
- std::vector<Value*> Indices;
- Indices.push_back(Constant::getNullValue(Type::Int32Ty));
- Indices.push_back(Indices[0]);
- Value *NewGEP = new GetElementPtrInst(NewMI, Indices,
+ Value* Indices[2];
+ Indices[0] = Indices[1] = Constant::getNullValue(Type::Int32Ty);
+ Value *NewGEP = new GetElementPtrInst(NewMI, Indices, 2,
NewMI->getName()+".el0", MI);
MI->replaceAllUsesWith(NewGEP);
MI->eraseFromParent();
Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.90 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.91
--- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.90 Tue Jan 30 14:08:38 2007
+++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp Wed Jan 31 13:59:55 2007
@@ -505,10 +505,8 @@
// Now that we have the destination's length, we must index into the
// destination's pointer to get the actual memcpy destination (end of
// the string .. we're concatenating).
- std::vector<Value*> idx;
- idx.push_back(strlen_inst);
GetElementPtrInst* gep =
- new GetElementPtrInst(dest,idx,dest->getName()+".indexed",ci);
+ new GetElementPtrInst(dest, strlen_inst, dest->getName()+".indexed", ci);
// We have enough information to now generate the memcpy call to
// do the concatenation for us.
@@ -596,9 +594,8 @@
// strchr(s,c) -> offset_of_in(c,s)
// (if c is a constant integer and s is a constant string)
if (char_found) {
- std::vector<Value*> indices;
- indices.push_back(ConstantInt::get(Type::Int64Ty,offset));
- GetElementPtrInst* GEP = new GetElementPtrInst(ci->getOperand(1),indices,
+ Value* Idx = ConstantInt::get(Type::Int64Ty,offset);
+ GetElementPtrInst* GEP = new GetElementPtrInst(ci->getOperand(1), Idx,
ci->getOperand(1)->getName()+".strchr",ci);
ci->replaceAllUsesWith(GEP);
} else {
More information about the llvm-commits
mailing list