From 435f9b4c260a5be236f9c1748f01bcb6e664aef7 Mon Sep 17 00:00:00 2001 From: Andy Ayers Date: Mon, 25 May 2026 12:48:00 -0700 Subject: [PATCH] JIT: Defer fgSetOptions until after 2nd-pass EH removal The JIT will sometimes commit to fully-interruptible GC too early. Wait until we've had a second chance to remove EH regions. --- src/coreclr/jit/compiler.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/coreclr/jit/compiler.cpp b/src/coreclr/jit/compiler.cpp index 72a7d68e8a444f..2ab36e3caa22c8 100644 --- a/src/coreclr/jit/compiler.cpp +++ b/src/coreclr/jit/compiler.cpp @@ -4588,9 +4588,6 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl lvaRefCountState = RCS_INVALID; fgLocalVarLivenessDone = false; - // Decide the kind of code we want to generate - fgSetOptions(); - fgExpandQmarkNodes(/*early*/ false); #ifdef DEBUG @@ -4675,6 +4672,12 @@ void Compiler::compCompile(void** methodCodePtr, uint32_t* methodCodeSize, JitFl fgDebugCheckLinks(); #endif + // Decide the kind of code we want to generate. Done here, after the second + // round of empty-EH removal above, so that EH eliminated post-morph doesn't + // force fully-interruptible codegen / a frame pointer. + // + fgSetOptions(); + // Morph multi-dimensional array operations. // (Consider deferring all array operation morphing, including single-dimensional array ops, // from global morph to here, so cloning doesn't have to deal with morphed forms.)