Skip to content

Commit 075b42d

Browse files
authored
JIT: Mark some intrinsics as must-expand for NAOT due to ILScanner dependencies (#109609)
These two intrinsics are treated specially by ILScanner, and thus must always be expanded for NAOT, even in MinOpts.
1 parent 1ddfa14 commit 075b42d

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/coreclr/jit/importercalls.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3384,17 +3384,27 @@ GenTree* Compiler::impIntrinsic(CORINFO_CLASS_HANDLE clsHnd,
33843384

33853385
if (IsTargetAbi(CORINFO_NATIVEAOT_ABI))
33863386
{
3387-
// Intrinsics that we should make every effort to expand for NativeAOT.
3388-
// If the intrinsic cannot possibly be expanded, it's fine, but
3389-
// if it can be, it should expand.
33903387
switch (ni)
33913388
{
3389+
// Intrinsics that we should make every effort to expand for NativeAOT.
3390+
// If the intrinsic cannot possibly be expanded, it's fine, but
3391+
// if it can be, it should expand.
33923392
case NI_System_Runtime_CompilerServices_RuntimeHelpers_CreateSpan:
33933393
case NI_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray:
3394+
betterToExpand = true;
3395+
break;
3396+
3397+
// Intrinsics that we should always expand for NativeAOT. These are
3398+
// required to be expanded due to ILScanner assumptions.
33943399
case NI_Internal_Runtime_MethodTable_Of:
33953400
case NI_System_Activator_AllocatorOf:
33963401
case NI_System_Activator_DefaultConstructorOf:
3397-
betterToExpand = true;
3402+
case NI_System_Runtime_CompilerServices_RuntimeHelpers_IsReferenceOrContainsReferences:
3403+
mustExpand = true;
3404+
break;
3405+
3406+
case NI_System_Runtime_InteropService_MemoryMarshal_GetArrayDataReference:
3407+
mustExpand |= sig->sigInst.methInstCount == 1;
33983408
break;
33993409

34003410
default:

0 commit comments

Comments
 (0)