aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-06-24 06:49:18 +0000
committerChris Lattner <sabre@nondot.org>2004-06-24 06:49:18 +0000
commita25502acd7c0d56cbd20da37f25830d81be834c5 (patch)
treed1a290ab384dc1ab622d0c99cb80df58244a5052 /lib/Transforms
parent7548a540f74be48b3d900134e7220155aab1703a (diff)
Two fixes. First, stop using the ugly shouldSubstituteIndVar method.
Second, disable substitution of quadratic addrec expressions to avoid putting multiplies in loops! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14358 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/IndVarSimplify.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp
index 56f021334b..5c4c63be5b 100644
--- a/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -602,7 +602,13 @@ void IndVarSimplify::runOnLoop(Loop *L) {
if (PN->getType()->isInteger()) { // FIXME: when we have fast-math, enable!
SCEVHandle SCEV = SE->getSCEV(PN);
if (SCEV->hasComputableLoopEvolution(L))
- if (SE->shouldSubstituteIndVar(SCEV)) // HACK!
+ // FIXME: Without a strength reduction pass, it is an extremely bad idea
+ // to indvar substitute anything more complex than a linear induction
+ // 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));
}