From 2f62fdc9a71d790d381d7f17d16e7098e30217e3 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 6 Mar 2005 22:52:29 +0000 Subject: [PATCH] fix a bug where we thought arguments were constants :( git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20506 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LoopStrengthReduce.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 95c1850089f..6c0290ae8c7 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/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(operand) || isa(operand)) { + } else if (isa(operand)) { + pre_op_vector.push_back(operand); + AllConstantOperands = false; + } else if (isa(operand)) { pre_op_vector.push_back(operand); } else if (Instruction *inst = dyn_cast(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");