Skip to content

Commit ac7f8e0

Browse files
authored
Fix BCE regression (#115980)
1 parent 12eba0a commit ac7f8e0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/coreclr/jit/rangecheck.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,7 @@ bool RangeCheck::ComputeDoesOverflow(BasicBlock* block, GenTree* expr, const Ran
14861486
{
14871487
overflows = false;
14881488
}
1489-
else if (expr->OperIs(GT_IND))
1489+
else if (expr->OperIs(GT_IND, GT_ARR_LENGTH))
14901490
{
14911491
overflows = false;
14921492
}
@@ -1644,6 +1644,11 @@ Range RangeCheck::ComputeRange(BasicBlock* block, GenTree* expr, bool monIncreas
16441644
// TODO: consider computing range for CastOp and intersect it with this.
16451645
range = GetRangeFromType(expr->AsCast()->CastToType());
16461646
}
1647+
else if (expr->OperIs(GT_ARR_LENGTH))
1648+
{
1649+
// Better than keUnknown
1650+
range = Range(Limit(Limit::keConstant, 0), Limit(Limit::keConstant, CORINFO_Array_MaxLength));
1651+
}
16471652
else
16481653
{
16491654
// The expression is not recognized, so the result is unknown.

0 commit comments

Comments
 (0)