aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/IndVarSimplify.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-07-26 02:47:12 +0000
committerChris Lattner <sabre@nondot.org>2004-07-26 02:47:12 +0000
commit595ee7ec26432e4804f1e71817d9cf9b1f86318d (patch)
tree4eabcea50fecab9c2abb5d98ddd28bad8cedb94a /lib/Transforms/Scalar/IndVarSimplify.cpp
parent8d65a06a3ec0d091c1c2d63c9e934f717b39c0c2 (diff)
Throttle back indvar substitution from creating multiplies in loops. This is bad bad bad.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15227 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/IndVarSimplify.cpp')
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index 5c4c63be5b..7c1f1161f5 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -607,9 +607,9 @@ void IndVarSimplify::runOnLoop(Loop *L) {
// variable. Doing so will put expensive multiply instructions inside
// of the loop. For now just disable indvar subst on anything more
// complex than a linear addrec.
- if (!isa<SCEVAddRecExpr>(SCEV) ||
- cast<SCEVAddRecExpr>(SCEV)->getNumOperands() < 3)
- IndVars.push_back(std::make_pair(PN, SCEV));
+ if (SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(SCEV))
+ if (AR->getNumOperands() == 2 && isa<SCEVConstant>(AR->getOperand(1)))
+ IndVars.push_back(std::make_pair(PN, SCEV));
}
// If there are no induction variables in the loop, there is nothing more to