When testing whether one loop contains another, test this directly

rather than testing whether the loop contains the other's header.

llvm-svn: 111039
This commit is contained in:
Dan Gohman 2010-08-13 20:23:25 +00:00
parent 3324b9ec67
commit 63c020a210
1 changed files with 2 additions and 2 deletions

View File

@ -2047,9 +2047,9 @@ ScalarEvolution::getAddRecExpr(SmallVectorImpl<const SCEV *> &Operands,
// Canonicalize nested AddRecs in by nesting them in order of loop depth.
if (const SCEVAddRecExpr *NestedAR = dyn_cast<SCEVAddRecExpr>(Operands[0])) {
const Loop *NestedLoop = NestedAR->getLoop();
if (L->contains(NestedLoop->getHeader()) ?
if (L->contains(NestedLoop) ?
(L->getLoopDepth() < NestedLoop->getLoopDepth()) :
(!NestedLoop->contains(L->getHeader()) &&
(!NestedLoop->contains(L) &&
DT->dominates(L->getHeader(), NestedLoop->getHeader()))) {
SmallVector<const SCEV *, 4> NestedOperands(NestedAR->op_begin(),
NestedAR->op_end());