Skip to content

Commit e8c8407

Browse files
committed
[Polly] Break early when the result is known. NFC.
1 parent 20e6265 commit e8c8407

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

polly/lib/Support/ScopHelper.cpp

+10-4
Original file line numberDiff line numberDiff line change
@@ -428,13 +428,19 @@ bool polly::isErrorBlock(BasicBlock &BB, const Region &R, LoopInfo &LI,
428428
// as their execution can not be a rare event.
429429
bool DominatesAllPredecessors = true;
430430
if (R.isTopLevelRegion()) {
431-
for (BasicBlock &I : *R.getEntry()->getParent())
432-
if (isa<ReturnInst>(I.getTerminator()) && !DT.dominates(&BB, &I))
431+
for (BasicBlock &I : *R.getEntry()->getParent()) {
432+
if (isa<ReturnInst>(I.getTerminator()) && !DT.dominates(&BB, &I)) {
433433
DominatesAllPredecessors = false;
434+
break;
435+
}
436+
}
434437
} else {
435-
for (auto Pred : predecessors(R.getExit()))
436-
if (R.contains(Pred) && !DT.dominates(&BB, Pred))
438+
for (auto Pred : predecessors(R.getExit())) {
439+
if (R.contains(Pred) && !DT.dominates(&BB, Pred)) {
437440
DominatesAllPredecessors = false;
441+
break;
442+
}
443+
}
438444
}
439445

440446
if (DominatesAllPredecessors)

0 commit comments

Comments
 (0)