[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.
This commit is contained in:
Roman Lebedev 2020-08-29 14:52:15 +03:00
parent 9c1ca8a3f7
commit 49d223274f
No known key found for this signature in database
GPG Key ID: 083C3EBB4A1689E0
1 changed files with 4 additions and 0 deletions

View File

@ -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) {