Skip to content

Commit 32e8320

Browse files
committed
Review feedback
1 parent bd47a52 commit 32e8320

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/coreclr/jit/compiler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3522,7 +3522,7 @@ inline genTreeOps Compiler::LoopDsc::lpTestOper() const
35223522

35233523
inline bool Compiler::LoopDsc::lpIsIncreasingLoop() const
35243524
{
3525-
// Increasing loop is the one that has "+=" increament operation and "< or <=" limit check.
3525+
// Increasing loop is the one that has "+=" increment operation and "< or <=" limit check.
35263526
bool isLessThanLimitCheck = GenTree::StaticOperIs(lpTestOper(), GT_LT, GT_LE);
35273527
return (isLessThanLimitCheck &&
35283528
(((lpIterOper() == GT_ADD) && (lpIterConst() > 0)) || ((lpIterOper() == GT_SUB) && (lpIterConst() < 0))));

src/coreclr/jit/loopcloning.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,8 +1024,8 @@ bool Compiler::optDeriveLoopCloningConditions(unsigned loopNum, LoopCloneContext
10241024

10251025
LoopDsc* loop = &optLoopTable[loopNum];
10261026
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());
10291029

10301030
if (GenTree::StaticOperIs(loop->lpTestOper(), GT_LT, GT_LE, GT_GT, GT_GE))
10311031
{
@@ -1034,13 +1034,13 @@ bool Compiler::optDeriveLoopCloningConditions(unsigned loopNum, LoopCloneContext
10341034
// is beyond the limit.
10351035
int stride = abs(loop->lpIterConst());
10361036

1037-
if (stride > 58)
1037+
if (stride >= 58)
10381038
{
10391039
// 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,
10411041
// the maximum stride limit is set to
10421042
// (int.MaxValue - (Array.MaxLength - 1) + 1), which is
1043-
// (0X7FFFFFC7 - 0x7fffffc7 + 2) = 0x3a or 58.
1043+
// (0X7fffffff - 0x7fffffc7 + 2) = 0x3a or 58.
10441044
return false;
10451045
}
10461046

@@ -1149,12 +1149,12 @@ bool Compiler::optDeriveLoopCloningConditions(unsigned loopNum, LoopCloneContext
11491149
}
11501150

11511151
// 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)
11541154
//
11551155
// 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)
11581158
genTreeOps opLimitCondition;
11591159
switch (loop->lpTestOper())
11601160
{
@@ -1664,7 +1664,6 @@ bool Compiler::optIsLoopClonable(unsigned loopInd)
16641664
// - The incrementing operator is multiple and divide
16651665
// - The ones that are inverted are not handled here for cases like "i *= 2" because
16661666
// they are converted to "i + i".
1667-
// bool isOtherLoop = (loop.lpIterOper() == GT_DIV) || (loop.lpIterOper() == GT_MUL);
16681667
if (!(loop.lpIsIncreasingLoop() || loop.lpIsDecreasingLoop()))
16691668
{
16701669
JITDUMP("Loop cloning: rejecting loop " FMT_LP

0 commit comments

Comments
 (0)