[llvm] 69a43e5 - [NFCI][SimplifyCFG] simplifyReturn(): use DeleteDeadBlock()

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


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

URL: https://github.com/llvm/llvm-project/commit/69a43e5fc5ead9e53f975a0ca41cc62c78f644ec
DIFF: https://github.com/llvm/llvm-project/commit/69a43e5fc5ead9e53f975a0ca41cc62c78f644ec.diff

LOG: [NFCI][SimplifyCFG] simplifyReturn(): 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 940f9c5b897e..ffeafeac1771 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -4645,13 +4645,8 @@ bool SimplifyCFGOpt::simplifyReturn(ReturnInst *RI, IRBuilder<> &Builder) {
     }
 
     // If we eliminated all predecessors of the block, delete the block now.
-    if (pred_empty(BB)) {
-      // We know there are no successors, so just nuke the block.
-      if (DTU)
-        DTU->deleteBB(BB);
-      else
-        BB->eraseFromParent();
-    }
+    if (pred_empty(BB))
+      DeleteDeadBlock(BB, DTU);
 
     return true;
   }


        


More information about the llvm-commits mailing list