eliminate a malloc/free for (almost) every GEP processed. This speeds up

IPSCCP 3.3% on kimwitu.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33793 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2007-02-02 20:51:48 +00:00
parent b59673e650
commit e777ff21b0

View File

@ -968,7 +968,7 @@ void SCCPSolver::visitGetElementPtrInst(GetElementPtrInst &I) {
LatticeVal &IV = ValueState[&I];
if (IV.isOverdefined()) return;
std::vector<Constant*> Operands;
SmallVector<Constant*, 8> Operands;
Operands.reserve(I.getNumOperands());
for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) {
@ -986,7 +986,8 @@ void SCCPSolver::visitGetElementPtrInst(GetElementPtrInst &I) {
Constant *Ptr = Operands[0];
Operands.erase(Operands.begin()); // Erase the pointer from idx list...
markConstant(IV, &I, ConstantExpr::getGetElementPtr(Ptr, Operands));
markConstant(IV, &I, ConstantExpr::getGetElementPtr(Ptr, &Operands[0],
Operands.size()));
}
void SCCPSolver::visitStoreInst(Instruction &SI) {