diff --git a/src/coreclr/jit/codegenxarch.cpp b/src/coreclr/jit/codegenxarch.cpp index dc9dd7c8a249bf..8504f2fb3ec52d 100644 --- a/src/coreclr/jit/codegenxarch.cpp +++ b/src/coreclr/jit/codegenxarch.cpp @@ -6311,7 +6311,7 @@ void CodeGen::genCallInstruction(GenTreeCall* call X86_ARG(target_ssize_t stackA if (target != nullptr) { #ifdef TARGET_X86 - if (call->IsVirtualStub() && (call->gtCallType == CT_INDIRECT)) + if (call->IsVirtualStub() && (call->gtCallType == CT_INDIRECT) && !compiler->IsTargetAbi(CORINFO_NATIVEAOT_ABI)) { // On x86, we need to generate a very specific pattern for indirect VSD calls: // diff --git a/src/coreclr/jit/lowerxarch.cpp b/src/coreclr/jit/lowerxarch.cpp index 3f441215e37123..6ad03646f0b8f5 100644 --- a/src/coreclr/jit/lowerxarch.cpp +++ b/src/coreclr/jit/lowerxarch.cpp @@ -7829,7 +7829,7 @@ void Lowering::ContainCheckCallOperands(GenTreeCall* call) // // Where EAX is also used as an argument to the stub dispatch helper. Make // sure that the call target address is computed into EAX in this case. - if (call->IsVirtualStub() && (call->gtCallType == CT_INDIRECT)) + if (call->IsVirtualStub() && (call->gtCallType == CT_INDIRECT) && !comp->IsTargetAbi(CORINFO_NATIVEAOT_ABI)) { assert(ctrlExpr->isIndir()); MakeSrcContained(call, ctrlExpr); diff --git a/src/coreclr/jit/lsraxarch.cpp b/src/coreclr/jit/lsraxarch.cpp index c8a0f7f9cbc0e2..7f50c8be9b5077 100644 --- a/src/coreclr/jit/lsraxarch.cpp +++ b/src/coreclr/jit/lsraxarch.cpp @@ -1257,7 +1257,8 @@ int LinearScan::BuildCall(GenTreeCall* call) ctrlExprCandidates = RBM_INT_CALLEE_TRASH.GetIntRegSet(); } #ifdef TARGET_X86 - else if (call->IsVirtualStub() && (call->gtCallType == CT_INDIRECT)) + else if (call->IsVirtualStub() && (call->gtCallType == CT_INDIRECT) && + !compiler->IsTargetAbi(CORINFO_NATIVEAOT_ABI)) { // On x86, we need to generate a very specific pattern for indirect VSD calls: // diff --git a/src/coreclr/jit/morph.cpp b/src/coreclr/jit/morph.cpp index d9ef8f039c90e2..32a8853ce57a9d 100644 --- a/src/coreclr/jit/morph.cpp +++ b/src/coreclr/jit/morph.cpp @@ -1981,7 +1981,7 @@ void CallArgs::AddFinalArgsAndDetermineABIInfo(Compiler* comp, GenTreeCall* call // If/when we change that, the following code needs to be changed to correctly support the (TBD) managed calling // convention for x86/SSE. - addStubCellArg = call->gtCallType != CT_INDIRECT && comp->IsTargetAbi(CORINFO_NATIVEAOT_ABI); + addStubCellArg = comp->IsTargetAbi(CORINFO_NATIVEAOT_ABI); #endif // We are allowed to have a ret buffer argument combined