Skip to content

Commit 1b1e94d

Browse files
authored
JIT: Fix icon and vn mismatch in an assertion (#113072)
1 parent 52fbf3e commit 1b1e94d

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/coreclr/jit/assertionprop.cpp

+6-14
Original file line numberDiff line numberDiff line change
@@ -1336,23 +1336,15 @@ AssertionIndex Compiler::optCreateAssertion(GenTree* op1,
13361336

13371337
if (op2->gtOper == GT_CNS_INT)
13381338
{
1339-
ssize_t iconVal = op2->AsIntCon()->gtIconVal;
1340-
1341-
if (varTypeIsSmall(lclVar))
1339+
ssize_t iconVal = op2->AsIntCon()->IconValue();
1340+
if (varTypeIsSmall(lclVar) && op1->OperIs(GT_STORE_LCL_VAR))
13421341
{
13431342
iconVal = optCastConstantSmall(iconVal, lclVar->TypeGet());
1343+
if (!optLocalAssertionProp)
1344+
{
1345+
assertion.op2.vn = vnStore->VNForIntCon(static_cast<int>(iconVal));
1346+
}
13441347
}
1345-
1346-
#ifdef TARGET_ARM
1347-
// Do not Constant-Prop large constants for ARM
1348-
// TODO-CrossBitness: we wouldn't need the cast below if GenTreeIntCon::gtIconVal had
1349-
// target_ssize_t type.
1350-
if (!codeGen->validImmForMov((target_ssize_t)iconVal))
1351-
{
1352-
goto DONE_ASSERTION; // Don't make an assertion
1353-
}
1354-
#endif // TARGET_ARM
1355-
13561348
assertion.op2.u1.iconVal = iconVal;
13571349
assertion.op2.SetIconFlag(op2->GetIconHandleFlag(), op2->AsIntCon()->gtFieldSeq);
13581350
}

0 commit comments

Comments
 (0)