From 8c79559443c9aa9144d4d565c90cc7508caafbc1 Mon Sep 17 00:00:00 2001 From: Chris Lattner <sabre@nondot.org> Date: Sun, 6 Mar 2005 22:52:29 +0000 Subject: [PATCH] fix a bug where we thought arguments were constants :( llvm-svn: 20506 --- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 95c1850089ff..6c0290ae8c71 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -154,15 +154,19 @@ void LoopStrengthReduce::strengthReduceGEP(GetElementPtrInst *GEPI, Loop *L, inc_op_vector.push_back(ConstantInt::get(Ty, 1)); indvar = op; break; - } else if (isa<Constant>(operand) || isa<Argument>(operand)) { + } else if (isa<Argument>(operand)) { + pre_op_vector.push_back(operand); + AllConstantOperands = false; + } else if (isa<Constant>(operand)) { pre_op_vector.push_back(operand); } else if (Instruction *inst = dyn_cast<Instruction>(operand)) { if (!DS->dominates(inst, Preheader->getTerminator())) return; pre_op_vector.push_back(operand); AllConstantOperands = false; - } else - return; + } else { + return; // Cannot handle this. + } Cache = Cache->get(operand); } assert(indvar > 0 && "Indvar used by GEP not found in operand list");