From cee894865af5867b6b92d851cbedbb7f01841554 Mon Sep 17 00:00:00 2001 From: Egor Bogatov Date: Tue, 1 Sep 2026 15:26:01 +0200 Subject: [PATCH] JIT: Skip non-inlineable GDV tail calls Avoid retaining devirtualization-only GDV candidates for tail calls. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0458833e-ff11-4cb8-9ca0-8e06f2034c2d --- src/coreclr/jit/importercalls.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/coreclr/jit/importercalls.cpp b/src/coreclr/jit/importercalls.cpp index 35cd6e984398ca..bb2cd33fb8991a 100644 --- a/src/coreclr/jit/importercalls.cpp +++ b/src/coreclr/jit/importercalls.cpp @@ -9141,14 +9141,9 @@ bool Compiler::canKeepNonInlineableGdvCandidate(GenTreeCall* call) return false; } - // An explicit tail call has to stay a tail call, so don't perturb its shape. + // Don't keep non-inlineable GDV candidates for tail calls. // - // Implicit ones are fine: fgMorphPotentialTailCall can tail call out of the - // BBJ_ALWAYS blocks the expansion produces. That includes recursive ones - - // the tail-recursion-to-loop transform requires a non-virtual callee, so - // devirtualizing here is what makes it possible in the first place. - // - if (call->IsTailPrefixedCall()) + if (call->CanTailCall()) { return false; }