[llvm] e4a589b - [InstCombine] Add stats for number of iterations (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 6 06:17:58 PDT 2023


Author: Nikita Popov
Date: 2023-06-06T15:17:47+02:00
New Revision: e4a589ba5dbd426d30d945ebf8210c8d5114f5b9

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

LOG: [InstCombine] Add stats for number of iterations (NFC)

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 80abfc900f659..311dd5a2244bb 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -114,6 +114,11 @@ using namespace llvm::PatternMatch;
 
 STATISTIC(NumWorklistIterations,
           "Number of instruction combining iterations performed");
+STATISTIC(NumOneIteration, "Number of functions with one iteration");
+STATISTIC(NumTwoIterations, "Number of functions with two iterations");
+STATISTIC(NumThreeIterations, "Number of functions with three iterations");
+STATISTIC(NumFourOrMoreIterations,
+          "Number of functions with four or more iterations");
 
 STATISTIC(NumCombined , "Number of insts combined");
 STATISTIC(NumConstProp, "Number of constant folds");
@@ -4051,6 +4056,15 @@ static bool combineInstructionsOverFunction(
     MadeIRChange = true;
   }
 
+  if (Iteration == 1)
+    ++NumOneIteration;
+  else if (Iteration == 2)
+    ++NumTwoIterations;
+  else if (Iteration == 3)
+    ++NumThreeIterations;
+  else
+    ++NumFourOrMoreIterations;
+
   return MadeIRChange;
 }
 


        


More information about the llvm-commits mailing list