Change ScalarEvolution::getSCEVAtScope to always return the original value

in the case where a loop exit value cannot be computed, instead of only in
some cases while using SCEVCouldNotCompute in others. This simplifies
getSCEVAtScope's callers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72375 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2009-05-24 23:25:42 +00:00
parent c046c00d0a
commit d594e6f034
3 changed files with 12 additions and 27 deletions

View File

@@ -275,10 +275,8 @@ void IndVarSimplify::RewriteLoopExitValues(Loop *L,
// Okay, this instruction has a user outside of the current loop
// and varies predictably *inside* the loop. Evaluate the value it
// contains when the loop exits, if possible.
SCEVHandle SH = SE->getSCEV(Inst);
SCEVHandle ExitValue = SE->getSCEVAtScope(SH, L->getParentLoop());
if (isa<SCEVCouldNotCompute>(ExitValue) ||
!ExitValue->isLoopInvariant(L))
SCEVHandle ExitValue = SE->getSCEVAtScope(Inst, L->getParentLoop());
if (!ExitValue->isLoopInvariant(L))
continue;
Changed = true;