[Polly] Break early when the result is known. NFC.

This commit is contained in:
Michael Kruse 2021-08-18 12:22:21 -05:00
parent 20e6265873
commit e8c8407aca

View file

@ -428,13 +428,19 @@ bool polly::isErrorBlock(BasicBlock &BB, const Region &R, LoopInfo &LI,
// as their execution can not be a rare event.
bool DominatesAllPredecessors = true;
if (R.isTopLevelRegion()) {
for (BasicBlock &I : *R.getEntry()->getParent())
if (isa<ReturnInst>(I.getTerminator()) && !DT.dominates(&BB, &I))
for (BasicBlock &I : *R.getEntry()->getParent()) {
if (isa<ReturnInst>(I.getTerminator()) && !DT.dominates(&BB, &I)) {
DominatesAllPredecessors = false;
break;
}
}
} else {
for (auto Pred : predecessors(R.getExit()))
if (R.contains(Pred) && !DT.dominates(&BB, Pred))
for (auto Pred : predecessors(R.getExit())) {
if (R.contains(Pred) && !DT.dominates(&BB, Pred)) {
DominatesAllPredecessors = false;
break;
}
}
}
if (DominatesAllPredecessors)