[llvm] a42f589 - [LICM][NFC] Unify arithmetic statistics collection

Max Kazantsev via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 11 03:20:20 PDT 2023


Author: Max Kazantsev
Date: 2023-04-11T17:20:02+07:00
New Revision: a42f589197f2ba95a8dbc3eb5c31f7bb721f8884

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

LOG: [LICM][NFC] Unify arithmetic statistics collection

Avoid divergence b/w different kinds of hoisting with reassociation.
Make them all collect general stat NumHoisted and also specific stats
for each particular transform.

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/LICM.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index c6b315290dd8..6742151bb4e4 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -105,6 +105,8 @@ STATISTIC(NumLoadPromoted, "Number of load-only promotions");
 STATISTIC(NumLoadStorePromoted, "Number of load and store promotions");
 STATISTIC(NumMinMaxHoisted,
           "Number of min/max expressions hoisted out of the loop");
+STATISTIC(NumGEPsHoisted,
+          "Number of geps reassociated and hoisted out of the loop");
 
 /// Memory promotion is enabled by default.
 static cl::opt<bool>
@@ -2553,6 +2555,7 @@ static bool hoistArithmetics(Instruction &I, Loop &L,
   // into (x < min(INV1, INV2)), and hoisting the invariant part of this
   // expression out of the loop.
   if (hoistMinMax(I, L, SafetyInfo, MSSAU)) {
+    ++NumHoisted;
     ++NumMinMaxHoisted;
     return true;
   }
@@ -2560,6 +2563,7 @@ static bool hoistArithmetics(Instruction &I, Loop &L,
   // Try to hoist GEPs by reassociation.
   if (hoistGEP(I, L, SafetyInfo, MSSAU, AC, DT)) {
     ++NumHoisted;
+    ++NumGEPsHoisted;
     return true;
   }
 


        


More information about the llvm-commits mailing list