[NFC][SimplifyCFG] HoistThenElseCodeToIf(): count number of common instructions hoisted
authorRoman Lebedev <lebedev.ri@gmail.com>
Wed, 15 Jul 2020 21:05:25 +0000 (00:05 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Wed, 15 Jul 2020 21:21:56 +0000 (00:21 +0300)
llvm/lib/Transforms/Utils/SimplifyCFG.cpp

index a1483537afd77ff1e545ec8895533d2a30f399ac..3befb7cc23f8f00e4caaa71f66017b3a711f77d1 100644 (file)
@@ -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 @@ HoistTerminator:
     I2->replaceAllUsesWith(NT);
     NT->takeName(I1);
   }
+  ++NumHoistCommonInstrs;
 
   // Ensure terminator gets a debug location, even an unknown one, in case
   // it involves inlinable calls.