Skip to content

Commit

Permalink
JIT: Add some metrics for widening IVs (#99051)
Browse files Browse the repository at this point in the history
Forgot to add these as part of the IV widening PR.
  • Loading branch information
jakobbotsch authored Feb 29, 2024
1 parent a0063de commit 537052c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/coreclr/jit/inductionvariableopts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@ PhaseStatus Compiler::optInductionVariables()
DBEXEC(verbose, FlowGraphNaturalLoop::Dump(loop));
scevContext.ResetForLoop(loop);

int numWidened = 0;

for (Statement* stmt : loop->GetHeader()->Statements())
{
if (!stmt->IsPhiDefnStmt())
Expand Down Expand Up @@ -666,6 +668,14 @@ PhaseStatus Compiler::optInductionVariables()
}

optSinkWidenedIV(lcl->GetLclNum(), newLclNum, loop);

numWidened++;
}

Metrics.WidenedIVs += numWidened;
if (numWidened > 0)
{
Metrics.LoopsIVWidened++;
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/jit/jitmetadatalist.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ JITMETADATAMETRIC(LoopsCloned, int, 0)
JITMETADATAMETRIC(LoopsUnrolled, int, 0)
JITMETADATAMETRIC(LoopAlignmentCandidates, int, 0)
JITMETADATAMETRIC(LoopsAligned, int, 0)
JITMETADATAMETRIC(LoopsIVWidened, int, 0)
JITMETADATAMETRIC(WidenedIVs, int, 0)
JITMETADATAMETRIC(VarsInSsa, int, 0)
JITMETADATAMETRIC(HoistedExpressions, int, 0)
JITMETADATAMETRIC(RedundantBranchesEliminated, int, JIT_METADATA_HIGHER_IS_BETTER)
Expand Down

0 comments on commit 537052c

Please sign in to comment.