aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/LoopStrengthReduce.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-03-06 22:52:29 +0000
committerChris Lattner <sabre@nondot.org>2005-03-06 22:52:29 +0000
commit2f62fdc9a71d790d381d7f17d16e7098e30217e3 (patch)
tree8e9be1a2dcae7fb3f310aadbe330768d8dc6d331 /lib/Transforms/Scalar/LoopStrengthReduce.cpp
parent3f93197098e8c553fefdc2a1b6444838c222695b (diff)
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
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");