Skip to content

Commit a13b7df

Browse files
[CodeGen] Use llvm::successors (NFC)
1 parent 5b2772e commit a13b7df

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

llvm/lib/CodeGen/CodeGenPrepare.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -972,10 +972,9 @@ bool CodeGenPrepare::isMergingEmptyBlockProfitable(BasicBlock *BB,
972972
// that leads to this block.
973973
// FIXME: Is this really needed? Is this a correctness issue?
974974
for (BasicBlock *Pred : predecessors(BB)) {
975-
if (auto *CBI = dyn_cast<CallBrInst>((Pred)->getTerminator()))
976-
for (unsigned i = 0, e = CBI->getNumSuccessors(); i != e; ++i)
977-
if (DestBB == CBI->getSuccessor(i))
978-
return false;
975+
if (isa<CallBrInst>(Pred->getTerminator()) &&
976+
llvm::is_contained(successors(Pred), DestBB))
977+
return false;
979978
}
980979

981980
// Try to skip merging if the unique predecessor of BB is terminated by a

0 commit comments

Comments
 (0)