[NFCI][Local] MergeBlockIntoPredecessor(): use DeleteDeadBlocks()

This commit is contained in:
Roman Lebedev 2021-05-19 19:53:48 +03:00
parent b0bb2149b3
commit c60ca9856c
No known key found for this signature in database
GPG Key ID: 083C3EBB4A1689E0
1 changed files with 4 additions and 10 deletions

View File

@ -298,17 +298,11 @@ bool llvm::MergeBlockIntoPredecessor(BasicBlock *BB, DomTreeUpdater *DTU,
if (MemDep)
MemDep->invalidateCachedPredecessors();
// Finally, erase the old block and update dominator info.
if (DTU) {
assert(BB->getInstList().size() == 1 &&
isa<UnreachableInst>(BB->getTerminator()) &&
"The successor list of BB isn't empty before "
"applying corresponding DTU updates.");
if (DTU)
DTU->applyUpdates(Updates);
DTU->deleteBB(BB);
} else {
BB->eraseFromParent(); // Nuke BB if DTU is nullptr.
}
// Finally, erase the old block and update dominator info.
DeleteDeadBlock(BB, DTU);
return true;
}