Skip to content

Commit b0849ee

Browse files
committed
Use Value::replaceAllUsesWith
1 parent bbb849c commit b0849ee

File tree

1 file changed

+1
-12
lines changed

1 file changed

+1
-12
lines changed

llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -710,20 +710,9 @@ Error OpenMPIRBuilder::FinalizationInfo::mergeFiniBB(IRBuilderBase &Builder,
710710
OtherFiniBB->splice(OtherFiniBB->getFirstNonPHIIt(), FiniBB, FiniBB->begin(),
711711
EndIt);
712712

713-
// Replace FiniBB with OtherFiniBB.
714-
for (User *U : make_early_inc_range(FiniBB->users())) {
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);
721-
}
722-
}
723-
assert(FiniBB->use_empty() && "Non branch use of FiniBB");
713+
FiniBB->replaceAllUsesWith(OtherFiniBB);
724714
FiniBB->eraseFromParent();
725715
FiniBB = OtherFiniBB;
726-
727716
return Error::success();
728717
}
729718

0 commit comments

Comments
 (0)