Skip to content

Commit

Permalink
[NFCI][Local] MergeBlockIntoPredecessor(): use DeleteDeadBlocks()
Browse files Browse the repository at this point in the history
  • Loading branch information
LebedevRI committed May 19, 2021
1 parent b0bb214 commit c60ca98
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
Expand Up @@ -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;
}
Expand Down

0 comments on commit c60ca98

Please sign in to comment.