From 6b791c86fb6b89f63eeb70ac794eed61ff9cd38d Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Mon, 15 Jun 2026 09:08:24 -0700 Subject: [PATCH] JIT: mark R2R direct-call target loads as non-faulting The two indirections introduced by LowerDirectCall (IAT_PVALUE) and LowerPEPCall load function pointers from R2R fixup slots / PEP locals that are guaranteed never null. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/coreclr/jit/lower.cpp | 3 ++- src/coreclr/jit/lowerwasm.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/coreclr/jit/lower.cpp b/src/coreclr/jit/lower.cpp index 0ebc1d6a008b77..690934c8da2bd8 100644 --- a/src/coreclr/jit/lower.cpp +++ b/src/coreclr/jit/lower.cpp @@ -6324,7 +6324,8 @@ GenTree* Lowering::LowerDirectCall(GenTreeCall* call) #ifdef DEBUG cellAddr->AsIntCon()->SetTargetHandle((size_t)call->gtCallMethHnd); #endif - GenTree* indir = Ind(cellAddr); + // The cell holds a function pointer that is never null. + GenTree* indir = m_compiler->gtNewIndir(TYP_I_IMPL, cellAddr, GTF_IND_NONFAULTING); result = indir; } break; diff --git a/src/coreclr/jit/lowerwasm.cpp b/src/coreclr/jit/lowerwasm.cpp index 585c3346e8f956..7595c9165d4a9d 100644 --- a/src/coreclr/jit/lowerwasm.cpp +++ b/src/coreclr/jit/lowerwasm.cpp @@ -105,7 +105,8 @@ void Lowering::LowerPEPCall(GenTreeCall* call) BlockRange().Remove(controlExpr); BlockRange().InsertBefore(call, controlExpr); - GenTree* target = Ind(controlExpr); + // The PEP local holds a function pointer that is never null. + GenTree* target = m_compiler->gtNewIndir(TYP_I_IMPL, controlExpr, GTF_IND_NONFAULTING); BlockRange().InsertBefore(call, target); call->gtControlExpr = target;