[llvm] c60ca98 - [NFCI][Local] MergeBlockIntoPredecessor(): use DeleteDeadBlocks()
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Wed May 19 10:39:02 PDT 2021
Author: Roman Lebedev
Date: 2021-05-19T20:38:30+03:00
New Revision: c60ca9856c9da19794b0f7b83b3002847e3fc9d9
URL: https://github.com/llvm/llvm-project/commit/c60ca9856c9da19794b0f7b83b3002847e3fc9d9
DIFF: https://github.com/llvm/llvm-project/commit/c60ca9856c9da19794b0f7b83b3002847e3fc9d9.diff
LOG: [NFCI][Local] MergeBlockIntoPredecessor(): use DeleteDeadBlocks()
Added:
Modified:
llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index e3cf643eb7ed..f79302625a54 100644
--- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -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;
}
More information about the llvm-commits
mailing list