Skip to content

Commit

Permalink
[LICM][NFC] Unify arithmetic statistics collection
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
xortator committed Apr 11, 2023
1 parent 4ac6f99 commit a42f589
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions llvm/lib/Transforms/Scalar/LICM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -2553,13 +2555,15 @@ 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;
}

// Try to hoist GEPs by reassociation.
if (hoistGEP(I, L, SafetyInfo, MSSAU, AC, DT)) {
++NumHoisted;
++NumGEPsHoisted;
return true;
}

Expand Down

0 comments on commit a42f589

Please sign in to comment.