diff --git a/src/coreclr/jit/inductionvariableopts.cpp b/src/coreclr/jit/inductionvariableopts.cpp index d30202680976e..b76d9e0be7438 100644 --- a/src/coreclr/jit/inductionvariableopts.cpp +++ b/src/coreclr/jit/inductionvariableopts.cpp @@ -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()) @@ -666,6 +668,14 @@ PhaseStatus Compiler::optInductionVariables() } optSinkWidenedIV(lcl->GetLclNum(), newLclNum, loop); + + numWidened++; + } + + Metrics.WidenedIVs += numWidened; + if (numWidened > 0) + { + Metrics.LoopsIVWidened++; } } diff --git a/src/coreclr/jit/jitmetadatalist.h b/src/coreclr/jit/jitmetadatalist.h index 8b69644d1a8fb..f36c15ab9991d 100644 --- a/src/coreclr/jit/jitmetadatalist.h +++ b/src/coreclr/jit/jitmetadatalist.h @@ -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)