aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/IndVarSimplify.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Scalar/IndVarSimplify.cpp')
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index 7f0e65e7f2..5e82ad0f7b 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -178,8 +178,11 @@ void IndVarSimplify::EliminatePointerRecurrence(PHINode *PN,
Constant *NCE = ConstantExpr::getGetElementPtr(CE->getOperand(0),
&CEIdxs[0],
CEIdxs.size());
+ Value *Idx[2];
+ Idx[0] = Constant::getNullValue(Type::Int32Ty);
+ Idx[1] = NewAdd;
GetElementPtrInst *NGEPI = new GetElementPtrInst(
- NCE, Constant::getNullValue(Type::Int32Ty), NewAdd,
+ NCE, Idx, Idx + 2,
GEPI->getName(), GEPI);
SE->deleteValueFromRecords(GEPI);
GEPI->replaceAllUsesWith(NGEPI);