[InstCombine] Add stats for number of iterations (NFC)
authorNikita Popov <npopov@redhat.com>
Tue, 6 Jun 2023 12:55:56 +0000 (14:55 +0200)
committerNikita Popov <npopov@redhat.com>
Tue, 6 Jun 2023 13:17:47 +0000 (15:17 +0200)
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

index 80abfc9..311dd5a 100644 (file)
@@ -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;
 }