[LV] Don't panic when encountering the IV of an outer loop.
Bail out instead of asserting when we encounter this situation, which can actually happen. The reason the test uses the new PM is that the "bad" phi, incidentally, gets cleaned up by LoopSimplify. But LICM can create this kind of phi and preserve loop simplify form, so the cleanup has no chance to run. This fixes PR31190. We may want to solve this in a less conservative manner, since this phi is actually uniform within the inner loop (or we may want LICM to output a cleaner promotion to begin with). Differential Revision: https://reviews.llvm.org/D28490 llvm-svn: 291589
This commit is contained in:
@@ -869,8 +869,13 @@ bool InductionDescriptor::isInductionPHI(PHINode *Phi, const Loop *TheLoop,
|
||||
return false;
|
||||
}
|
||||
|
||||
assert(TheLoop->getHeader() == Phi->getParent() &&
|
||||
"PHI is an AddRec for a different loop?!");
|
||||
if (AR->getLoop() != TheLoop) {
|
||||
// FIXME: We should treat this as a uniform. Unfortunately, we
|
||||
// don't currently know how to handled uniform PHIs.
|
||||
DEBUG(dbgs() << "LV: PHI is a recurrence with respect to an outer loop.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
Value *StartValue =
|
||||
Phi->getIncomingValueForBlock(AR->getLoop()->getLoopPreheader());
|
||||
const SCEV *Step = AR->getStepRecurrence(*SE);
|
||||
|
||||
Reference in New Issue
Block a user