[llvm] a587bf3 - [NFC][SimplifyCFG] Count the number of invokes turned into calls due to empty cleanup blocks

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 8 10:04:39 PDT 2020


Author: Roman Lebedev
Date: 2020-08-08T20:00:27+03:00
New Revision: a587bf3eb074340710a36c0c00c16dadcf5adb79

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

LOG: [NFC][SimplifyCFG] Count the number of invokes turned into calls due to empty cleanup blocks

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 a578bbd3f65b..a0e565849e1a 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -162,6 +162,8 @@ STATISTIC(NumSinkCommonCode,
 STATISTIC(NumSinkCommonInstrs,
           "Number of common instructions sunk down to the end block");
 STATISTIC(NumSpeculations, "Number of speculative executed instructions");
+STATISTIC(NumInvokes,
+          "Number of invokes with empty resume blocks simplified into calls");
 
 namespace {
 
@@ -4017,6 +4019,7 @@ bool SimplifyCFGOpt::simplifyCommonResume(ResumeInst *RI) {
          PI != PE;) {
       BasicBlock *Pred = *PI++;
       removeUnwindEdge(Pred);
+      ++NumInvokes;
     }
 
     // In each SimplifyCFG run, only the current processed block can be erased.
@@ -4072,6 +4075,7 @@ bool SimplifyCFGOpt::simplifySingleResume(ResumeInst *RI) {
   for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB); PI != PE;) {
     BasicBlock *Pred = *PI++;
     removeUnwindEdge(Pred);
+    ++NumInvokes;
   }
 
   // The landingpad is now unreachable.  Zap it.
@@ -4192,6 +4196,7 @@ static bool removeEmptyCleanup(CleanupReturnInst *RI) {
     BasicBlock *PredBB = *PI++;
     if (UnwindDest == nullptr) {
       removeUnwindEdge(PredBB);
+      ++NumInvokes;
     } else {
       Instruction *TI = PredBB->getTerminator();
       TI->replaceUsesOfWith(BB, UnwindDest);


        


More information about the llvm-commits mailing list