[llvm] 57d20cb - [NFCI][SimplifyCFG] simplifyUnreachable(): use DeleteDeadBlock()

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Wed May 19 02:05:08 PDT 2021


Author: Roman Lebedev
Date: 2021-05-19T12:04:22+03:00
New Revision: 57d20cbf467fc69ebd575209d101f73ab4461e84

URL: https://github.com/llvm/llvm-project/commit/57d20cbf467fc69ebd575209d101f73ab4461e84
DIFF: https://github.com/llvm/llvm-project/commit/57d20cbf467fc69ebd575209d101f73ab4461e84.diff

LOG: [NFCI][SimplifyCFG] simplifyUnreachable(): use DeleteDeadBlock()

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index ffeafeac1771..dd3c968341eb 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -4851,11 +4851,7 @@ bool SimplifyCFGOpt::simplifyUnreachable(UnreachableInst *UI) {
 
   // If this block is now dead, remove it.
   if (pred_empty(BB) && BB != &BB->getParent()->getEntryBlock()) {
-    // We know there are no successors, so just nuke the block.
-    if (DTU)
-      DTU->deleteBB(BB);
-    else
-      BB->eraseFromParent();
+    DeleteDeadBlock(BB, DTU);
     return true;
   }
 


        


More information about the llvm-commits mailing list