Skip to content

Commit 8a66e6e

Browse files
committed
Fix case where dividend is long that's known in range
1 parent 2d582cb commit 8a66e6e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/coreclr/jit/assertionprop.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4116,7 +4116,7 @@ void Compiler::optAssertionProp_RangeProperties(ASSERT_VALARG_TP assertions,
41164116
// 1) Convert DIV/MOD to UDIV/UMOD if both operands are proven to be never negative
41174117
// 2) Marks DIV/UDIV/MOD/UMOD with GTF_DIV_MOD_NO_BY_ZERO if divisor is proven to be never zero
41184118
// 3) Marks DIV/UDIV/MOD/UMOD with GTF_DIV_MOD_NO_OVERFLOW if both operands are proven to be never negative
4119-
// 4) UMOD with GTF_UMOD_UINT16_OPERANDS if both operands are proven to be in uint16 range
4119+
// 4) Marks UMOD with GTF_UMOD_UINT16_OPERANDS if both operands are proven to be in uint16 range
41204120
//
41214121
// Arguments:
41224122
// assertions - set of live assertions

src/coreclr/jit/lower.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -7221,9 +7221,9 @@ bool Lowering::LowerUnsignedDivOrMod(GenTreeOp* divMod)
72217221
BlockRange().InsertBefore(divMod, multiplier, mul1, cast, shiftAmount);
72227222
BlockRange().InsertBefore(divMod, mul2, shift);
72237223

7224-
// (int)result
7224+
// (int)result or (long)result
72257225
divMod->ChangeOper(GT_CAST);
7226-
divMod->AsCast()->gtCastType = TYP_INT;
7226+
divMod->AsCast()->gtCastType = type;
72277227
divMod->gtOp1 = shift;
72287228
divMod->gtOp2 = nullptr;
72297229
divMod->SetUnsigned();

0 commit comments

Comments
 (0)