Skip to content

Commit

Permalink
JIT: Mark some intrinsics as must-expand for NAOT due to ILScanner de…
Browse files Browse the repository at this point in the history
…pendencies (#109609)

These two intrinsics are treated specially by ILScanner, and thus must always be expanded for NAOT, even in MinOpts.
  • Loading branch information
jakobbotsch authored Nov 11, 2024
1 parent 1ddfa14 commit 075b42d
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/coreclr/jit/importercalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3384,17 +3384,27 @@ GenTree* Compiler::impIntrinsic(CORINFO_CLASS_HANDLE clsHnd,

if (IsTargetAbi(CORINFO_NATIVEAOT_ABI))
{
// Intrinsics that we should make every effort to expand for NativeAOT.
// If the intrinsic cannot possibly be expanded, it's fine, but
// if it can be, it should expand.
switch (ni)
{
// Intrinsics that we should make every effort to expand for NativeAOT.
// If the intrinsic cannot possibly be expanded, it's fine, but
// if it can be, it should expand.
case NI_System_Runtime_CompilerServices_RuntimeHelpers_CreateSpan:
case NI_System_Runtime_CompilerServices_RuntimeHelpers_InitializeArray:
betterToExpand = true;
break;

// Intrinsics that we should always expand for NativeAOT. These are
// required to be expanded due to ILScanner assumptions.
case NI_Internal_Runtime_MethodTable_Of:
case NI_System_Activator_AllocatorOf:
case NI_System_Activator_DefaultConstructorOf:
betterToExpand = true;
case NI_System_Runtime_CompilerServices_RuntimeHelpers_IsReferenceOrContainsReferences:
mustExpand = true;
break;

case NI_System_Runtime_InteropService_MemoryMarshal_GetArrayDataReference:
mustExpand |= sig->sigInst.methInstCount == 1;
break;

default:
Expand Down

0 comments on commit 075b42d

Please sign in to comment.