Skip to content

Commit f579745

Browse files
authored
JIT: fix crash in LSRA seen on VMR build on AVX-512 machines (#119206)
During the second stage bootstrap build VMR on an AVX-512 capable machine, we end up in `try_SPILL_COST` looking at a K-reg spill candidate without an assigned interval, and crash. This happens because the preceding heuristic `try_REG_ORDER` fails to find a register when it should, because mask register numbers are greater than 63 and we shift 1ULL by this amount to build a mask, which is undefined behavior. The fix is to always look up the mask via table fetch, which is set up to handle mask register numbers properly. Fixes the crash seen in #119070.
1 parent b2c0e89 commit f579745

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

src/coreclr/jit/target.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -954,17 +954,7 @@ inline SingleTypeRegSet genSingleTypeFloatMask(regNumber reg ARM_ARG(var_types t
954954
inline SingleTypeRegSet genSingleTypeRegMask(regNumber reg)
955955
{
956956
assert((unsigned)reg < ArrLen(regMasks));
957-
#ifdef TARGET_AMD64
958-
// shift is faster than a L1 hit on modern x86
959-
// (L1 latency on sandy bridge is 4 cycles for [base] and 5 for [base + index*c] )
960-
// the reason this is AMD-only is because the x86 BE will try to get reg masks for REG_STK
961-
// and the result needs to be zero.
962-
SingleTypeRegSet result = 1ULL << reg;
963-
assert(result == regMasks[reg]);
964-
return result;
965-
#else
966957
return regMasks[reg];
967-
#endif
968958
}
969959

970960
//------------------------------------------------------------------------

0 commit comments

Comments
 (0)