Skip to content

Commit c60ca98

Browse files
committed
[NFCI][Local] MergeBlockIntoPredecessor(): use DeleteDeadBlocks()
1 parent b0bb214 commit c60ca98

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

llvm/lib/Transforms/Utils/BasicBlockUtils.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -298,17 +298,11 @@ bool llvm::MergeBlockIntoPredecessor(BasicBlock *BB, DomTreeUpdater *DTU,
298298
if (MemDep)
299299
MemDep->invalidateCachedPredecessors();
300300

301-
// Finally, erase the old block and update dominator info.
302-
if (DTU) {
303-
assert(BB->getInstList().size() == 1 &&
304-
isa<UnreachableInst>(BB->getTerminator()) &&
305-
"The successor list of BB isn't empty before "
306-
"applying corresponding DTU updates.");
301+
if (DTU)
307302
DTU->applyUpdates(Updates);
308-
DTU->deleteBB(BB);
309-
} else {
310-
BB->eraseFromParent(); // Nuke BB if DTU is nullptr.
311-
}
303+
304+
// Finally, erase the old block and update dominator info.
305+
DeleteDeadBlock(BB, DTU);
312306

313307
return true;
314308
}

0 commit comments

Comments
 (0)