Skip to content

Commit

Permalink
[Polly] Break early when the result is known. NFC.
Browse files Browse the repository at this point in the history
  • Loading branch information
Meinersbur committed Aug 18, 2021
1 parent 20e6265 commit e8c8407
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions polly/lib/Support/ScopHelper.cpp
Expand Up @@ -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)
Expand Down

0 comments on commit e8c8407

Please sign in to comment.