From e9c0bac4c5de68c217f54a38eb786de3dface6a5 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 2 Feb 2007 20:51:48 +0000 Subject: [PATCH] eliminate a malloc/free for (almost) every GEP processed. This speeds up IPSCCP 3.3% on kimwitu. llvm-svn: 33793 --- lib/Transforms/Scalar/SCCP.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index d22a1e286bf..fdb5b1602a3 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -968,7 +968,7 @@ void SCCPSolver::visitGetElementPtrInst(GetElementPtrInst &I) { LatticeVal &IV = ValueState[&I]; if (IV.isOverdefined()) return; - std::vector Operands; + SmallVector 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) {