[llvm] 49d2232 - [NFC][InstCombine] Add STATISTIC() for how many iterations we did

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 29 05:11:15 PDT 2020


Author: Roman Lebedev
Date: 2020-08-29T15:10:13+03:00
New Revision: 49d223274f69bd67fe6e24535e3a2f68182f011b

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

LOG: [NFC][InstCombine] Add STATISTIC() for how many iterations we did

As we've established, if it takes more than two iterations
(one to perform folding and one to ensure that no folding opportunities
remain) per function, then there are worklist management issues.
So it may be interesting to keep track of it.

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 cb6e77aa029c..83f6df7e70be 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -114,6 +114,9 @@ using namespace llvm::PatternMatch;
 
 #define DEBUG_TYPE "instcombine"
 
+STATISTIC(NumWorklistIterations,
+          "Number of instruction combining iterations performed");
+
 STATISTIC(NumCombined , "Number of insts combined");
 STATISTIC(NumConstProp, "Number of constant folds");
 STATISTIC(NumDeadInst , "Number of dead inst eliminated");
@@ -3840,6 +3843,7 @@ static bool combineInstructionsOverFunction(
   // Iterate while there is work to do.
   unsigned Iteration = 0;
   while (true) {
+    ++NumWorklistIterations;
     ++Iteration;
 
     if (Iteration > InfiniteLoopDetectionThreshold) {


        


More information about the llvm-commits mailing list