Skip to content

Commit b509ab1

Browse files
authored
JIT: avoid looking for integral ranges for non-integer constants (#117220)
We increasingly see constant byrefs. Make sure those don't trip up range-based optimizations. Fixes #116861.
1 parent 74076ee commit b509ab1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/coreclr/jit/morph.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9065,6 +9065,14 @@ GenTree* Compiler::fgOptimizeRelationalComparisonWithFullRangeConst(GenTreeOp* c
90659065
return cmp;
90669066
}
90679067

9068+
GenTree* const op1 = cmp->gtGetOp1();
9069+
GenTree* const op2 = cmp->gtGetOp2();
9070+
9071+
if (!varTypeIsIntegral(op1->TypeGet()) || !varTypeIsIntegral(op2->TypeGet()))
9072+
{
9073+
return cmp;
9074+
}
9075+
90689076
int64_t lhsMin;
90699077
int64_t lhsMax;
90709078
if (cmp->gtGetOp1()->IsIntegralConst())

0 commit comments

Comments
 (0)