From: Chris Lattner Date: Mon, 26 Jul 2004 02:47:12 +0000 (+0000) Subject: Throttle back indvar substitution from creating multiplies in loops. This is bad... X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=595ee7ec26432e4804f1e71817d9cf9b1f86318d;p=oota-llvm.git 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 --- diff --git a/lib/Transforms/Scalar/IndVarSimplify.cpp b/lib/Transforms/Scalar/IndVarSimplify.cpp index 5c4c63be5ba..7c1f1161f59 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(SCEV) || - cast(SCEV)->getNumOperands() < 3) - IndVars.push_back(std::make_pair(PN, SCEV)); + if (SCEVAddRecExpr *AR = dyn_cast(SCEV)) + if (AR->getNumOperands() == 2 && isa(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