mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-11 13:37:07 +00:00
Two fixes. First, stop using the ugly shouldSubstituteIndVar method.
Second, disable substitution of quadratic addrec expressions to avoid putting multiplies in loops! llvm-svn: 14358
This commit is contained in:
parent
236ef1542c
commit
b4df848a58
@ -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));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user