Skip to content

Commit b95bccb

Browse files
authoredNov 29, 2023
Clear IconHandle when we fold compares (dotnet#95383)
Fixes dotnet#95367. Relevant part of the JitDump: ``` Using `if true` assertions from pred BB02 Assertions in: #1 fgMorphTree BB04, STMT00021 (before) [000070] DA--------- * STORE_LCL_VAR ubyte V10 tmp9 [000057] ----------- \--* CAST int <- ubyte <- int [000006] ----------- \--* EQ int [000004] ----------- +--* LCL_VAR ref V02 tmp1 (last use) [000055] H---------- \--* CNS_INT(h) ref 'Frozen EmptyPartition`1<Int32> object' Assertion prop for index #1 in BB04: [000006] ----------- * EQ int GenTreeNode creates assertion: [000070] DA---+----- * STORE_LCL_VAR ubyte V10 tmp9 In BB04 New Local Constant Assertion: V10 == [0000000000000001], index = #2 fgMorphTree BB04, STMT00021 (after) [000070] DA---+----- * STORE_LCL_VAR ubyte V10 tmp9 [000055] H----+----- \--* CNS_INT(h) int ``` The JitDump is unfinished because the compiler crashes when trying to dump the last line. Clearly, the `CNS_INT` is no longer a handle at that point because we just bashed it to a constant 1.
1 parent f66c1c1 commit b95bccb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed
 

‎src/coreclr/jit/assertionprop.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -4356,8 +4356,7 @@ GenTree* Compiler::optAssertionPropLocal_RelOp(ASSERT_VALARG_TP assertions, GenT
43564356
foldResult = !foldResult;
43574357
}
43584358

4359-
op2->AsIntCon()->gtIconVal = foldResult;
4360-
op2->gtType = TYP_INT;
4359+
op2->BashToConst((ssize_t)foldResult, TYP_INT);
43614360

43624361
return optAssertionProp_Update(op2, tree, stmt);
43634362
}

0 commit comments

Comments
 (0)
Please sign in to comment.