@@ -1024,8 +1024,8 @@ bool Compiler::optDeriveLoopCloningConditions(unsigned loopNum, LoopCloneContext
1024
1024
1025
1025
LoopDsc* loop = &optLoopTable[loopNum];
1026
1026
JitExpandArrayStack<LcOptInfo*>* optInfos = context->GetLoopOptInfo (loopNum);
1027
- bool isIncreasingLoop = GenTree::StaticOperIs ( loop->lpTestOper (), GT_LT, GT_LE );
1028
- assert (loop-> lpIsIncreasingLoop () || loop->lpIsDecreasingLoop ());
1027
+ bool isIncreasingLoop = loop->lpIsIncreasingLoop ( );
1028
+ assert (isIncreasingLoop || loop->lpIsDecreasingLoop ());
1029
1029
1030
1030
if (GenTree::StaticOperIs (loop->lpTestOper (), GT_LT, GT_LE, GT_GT, GT_GE))
1031
1031
{
@@ -1034,13 +1034,13 @@ bool Compiler::optDeriveLoopCloningConditions(unsigned loopNum, LoopCloneContext
1034
1034
// is beyond the limit.
1035
1035
int stride = abs (loop->lpIterConst ());
1036
1036
1037
- if (stride > 58 )
1037
+ if (stride >= 58 )
1038
1038
{
1039
1039
// Array.MaxLength can have maximum of 0X7FFFFFC7 elements, so make sure
1040
- // the stride increament doesn't overflow or underflow the index. Hence,
1040
+ // the stride increment doesn't overflow or underflow the index. Hence,
1041
1041
// the maximum stride limit is set to
1042
1042
// (int.MaxValue - (Array.MaxLength - 1) + 1), which is
1043
- // (0X7FFFFFC7 - 0x7fffffc7 + 2) = 0x3a or 58.
1043
+ // (0X7fffffff - 0x7fffffc7 + 2) = 0x3a or 58.
1044
1044
return false ;
1045
1045
}
1046
1046
@@ -1149,12 +1149,12 @@ bool Compiler::optDeriveLoopCloningConditions(unsigned loopNum, LoopCloneContext
1149
1149
}
1150
1150
1151
1151
// Increasing loops
1152
- // GT_LT loop test: (start < end) ==> (end <= start )
1153
- // GT_LE loop test: (start <= end) ==> (end < start )
1152
+ // GT_LT loop test: (start < end) ==> (end <= arrLen )
1153
+ // GT_LE loop test: (start <= end) ==> (end < arrLen )
1154
1154
//
1155
1155
// Decreasing loops
1156
- // GT_GT loop test: (end > start) ==> (end <= start )
1157
- // GT_GE loop test: (end >= start) ==> (end < start )
1156
+ // GT_GT loop test: (end > start) ==> (end <= arrLen )
1157
+ // GT_GE loop test: (end >= start) ==> (end < arrLen )
1158
1158
genTreeOps opLimitCondition;
1159
1159
switch (loop->lpTestOper ())
1160
1160
{
@@ -1664,7 +1664,6 @@ bool Compiler::optIsLoopClonable(unsigned loopInd)
1664
1664
// - The incrementing operator is multiple and divide
1665
1665
// - The ones that are inverted are not handled here for cases like "i *= 2" because
1666
1666
// they are converted to "i + i".
1667
- // bool isOtherLoop = (loop.lpIterOper() == GT_DIV) || (loop.lpIterOper() == GT_MUL);
1668
1667
if (!(loop.lpIsIncreasingLoop () || loop.lpIsDecreasingLoop ()))
1669
1668
{
1670
1669
JITDUMP (" Loop cloning: rejecting loop " FMT_LP
0 commit comments