@@ -884,13 +884,15 @@ bool Compiler::optMakeLoopDownwardsCounted(ScalarEvolutionContext& scevContext,
884
884
// With multiple exits we generally can only compute an upper bound on
885
885
// the trip count.
886
886
JITDUMP (" No; has multiple exits\n " );
887
+ Metrics.TripCountMultipleExits ++;
887
888
return false ;
888
889
}
889
890
890
891
BasicBlock* exiting = loop->ExitEdge (0 )->getSourceBlock ();
891
892
if (!exiting->KindIs (BBJ_COND))
892
893
{
893
894
JITDUMP (" No; exit is not BBJ_COND\n " );
895
+ Metrics.TripCountExitNotCond ++;
894
896
return false ;
895
897
}
896
898
@@ -905,6 +907,7 @@ bool Compiler::optMakeLoopDownwardsCounted(ScalarEvolutionContext& scevContext,
905
907
// transform; otherwise we could. TODO-CQ: Make this determination and
906
908
// extract side effects from the jtrue to make this work.
907
909
JITDUMP (" No; exit node has side effects\n " );
910
+ Metrics.TripCountExitSideEffects ++;
908
911
return false ;
909
912
}
910
913
@@ -914,6 +917,7 @@ bool Compiler::optMakeLoopDownwardsCounted(ScalarEvolutionContext& scevContext,
914
917
(cond->gtGetOp1 ()->IsIntegralConst (0 ) || cond->gtGetOp2 ()->IsIntegralConst (0 )))
915
918
{
916
919
JITDUMP (" No; operand of condition [%06u] is already 0\n " , dspTreeID (cond));
920
+ Metrics.TripCountExitAlreadyHas0 ++;
917
921
return false ;
918
922
}
919
923
@@ -970,18 +974,21 @@ bool Compiler::optMakeLoopDownwardsCounted(ScalarEvolutionContext& scevContext,
970
974
if (!rootNode->OperIsLocalStore ())
971
975
{
972
976
// Cannot reason about this use of the local, cannot remove
977
+ Metrics.TripCountNonStoreUse ++;
973
978
return false ;
974
979
}
975
980
976
981
if (rootNode->AsLclVarCommon ()->GetLclNum () != candidateLclNum)
977
982
{
978
983
// Used to compute a value stored to some other local, cannot remove
984
+ Metrics.TripCountStoredFrom ++;
979
985
return false ;
980
986
}
981
987
982
988
if ((rootNode->AsLclVarCommon ()->Data ()->gtFlags & GTF_SIDE_EFFECT) != 0 )
983
989
{
984
990
// May be used inside the data node for something that has side effects, cannot remove
991
+ Metrics.TripCountStoreMayHaveSideEffect ++;
985
992
return false ;
986
993
}
987
994
@@ -1007,6 +1014,7 @@ bool Compiler::optMakeLoopDownwardsCounted(ScalarEvolutionContext& scevContext,
1007
1014
1008
1015
if (checkProfitability && (removableLocals.Height () <= 0 ))
1009
1016
{
1017
+ Metrics.TripCountNoRemovableLocals ++;
1010
1018
JITDUMP (" Found no potentially removable locals when making this loop downwards counted\n " );
1011
1019
return false ;
1012
1020
}
@@ -1031,6 +1039,7 @@ bool Compiler::optMakeLoopDownwardsCounted(ScalarEvolutionContext& scevContext,
1031
1039
{
1032
1040
JITDUMP (" No; exiting block " FMT_BB " is not an ancestor of backedge source " FMT_BB " \n " ,
1033
1041
exiting->bbNum , backedge->getSourceBlock ()->bbNum );
1042
+ Metrics.TripCountBackedgesNotDominated ++;
1034
1043
return false ;
1035
1044
}
1036
1045
@@ -1043,6 +1052,7 @@ bool Compiler::optMakeLoopDownwardsCounted(ScalarEvolutionContext& scevContext,
1043
1052
{
1044
1053
JITDUMP (" No; exiting block " FMT_BB " does not dominate backedge source " FMT_BB " \n " , exiting->bbNum ,
1045
1054
backedge->getSourceBlock ()->bbNum );
1055
+ Metrics.TripCountBackedgesNotDominated ++;
1046
1056
return false ;
1047
1057
}
1048
1058
}
@@ -1055,6 +1065,7 @@ bool Compiler::optMakeLoopDownwardsCounted(ScalarEvolutionContext& scevContext,
1055
1065
if (tripCount == nullptr )
1056
1066
{
1057
1067
JITDUMP (" Could not compute trip count -- not a counted loop\n " );
1068
+ Metrics.TripCountCouldNotCompute ++;
1058
1069
return false ;
1059
1070
}
1060
1071
@@ -1070,6 +1081,7 @@ bool Compiler::optMakeLoopDownwardsCounted(ScalarEvolutionContext& scevContext,
1070
1081
if (decCountNode == nullptr )
1071
1082
{
1072
1083
JITDUMP (" Could not materialize trip count into IR\n " );
1084
+ Metrics.TripCountCouldNotMaterialize ++;
1073
1085
return false ;
1074
1086
}
1075
1087
0 commit comments