aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/Scalar/LoopStrengthReduce.cpp')
-rw-r--r--lib/Transforms/Scalar/LoopStrengthReduce.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 95c1850089..6c0290ae8c 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<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");