[llvm] 7b53ad8 - [NFC][SimplifyCFG] HoistThenElseCodeToIf(): count number of common instructions hoisted

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 15 14:22:33 PDT 2020


Author: Roman Lebedev
Date: 2020-07-16T00:21:56+03:00
New Revision: 7b53ad88d4a93df469550b5cfdb85c3058260034

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

LOG: [NFC][SimplifyCFG] HoistThenElseCodeToIf(): count number of common instructions hoisted

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 a1483537afd7..3befb7cc23f8 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -147,6 +147,8 @@ STATISTIC(
     NumLookupTablesHoles,
     "Number of switch instructions turned into lookup tables (holes checked)");
 STATISTIC(NumTableCmpReuses, "Number of reused switch table lookup compares");
+STATISTIC(NumHoistCommonInstrs,
+          "Number of common instructions hoisted up to the begin block");
 STATISTIC(NumSinkCommonCode,
           "Number of common instruction 'blocks' sunk down to the end block");
 STATISTIC(NumSinkCommonInstrs,
@@ -1355,6 +1357,7 @@ bool SimplifyCFGOpt::HoistThenElseCodeToIf(BranchInst *BI,
       I2->eraseFromParent();
       Changed = true;
     }
+    ++NumHoistCommonInstrs;
 
     I1 = &*BB1_Itr++;
     I2 = &*BB2_Itr++;
@@ -1409,6 +1412,7 @@ bool SimplifyCFGOpt::HoistThenElseCodeToIf(BranchInst *BI,
     I2->replaceAllUsesWith(NT);
     NT->takeName(I1);
   }
+  ++NumHoistCommonInstrs;
 
   // Ensure terminator gets a debug location, even an unknown one, in case
   // it involves inlinable calls.


        


More information about the llvm-commits mailing list