Skip to content

Commit bbb849c

Browse files
committed
Use early exits
1 parent b51c450 commit bbb849c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -712,11 +712,12 @@ Error OpenMPIRBuilder::FinalizationInfo::mergeFiniBB(IRBuilderBase &Builder,
712712

713713
// Replace FiniBB with OtherFiniBB.
714714
for (User *U : make_early_inc_range(FiniBB->users())) {
715-
if (auto *Instr = dyn_cast<Instruction>(U)) {
716-
for (unsigned I = 0, E = Instr->getNumSuccessors(); I != E; ++I) {
717-
if (Instr->getSuccessor(I) == FiniBB)
718-
Instr->setSuccessor(I, OtherFiniBB);
719-
}
715+
auto *Instr = dyn_cast<Instruction>(U);
716+
if (!Instr)
717+
continue;
718+
for (unsigned I = 0, E = Instr->getNumSuccessors(); I != E; ++I) {
719+
if (Instr->getSuccessor(I) == FiniBB)
720+
Instr->setSuccessor(I, OtherFiniBB);
720721
}
721722
}
722723
assert(FiniBB->use_empty() && "Non branch use of FiniBB");

0 commit comments

Comments
 (0)