Skip to content

Commit 2a87ffe

Browse files
authored
JIT: Disable implicit tailcalls for throwhelpers (#61006)
1 parent f9a2449 commit 2a87ffe

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/coreclr/jit/morph.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7132,15 +7132,11 @@ GenTree* Compiler::fgMorphPotentialTailCall(GenTreeCall* call)
71327132
return nullptr;
71337133
}
71347134

7135-
// Heuristic: regular calls to noreturn methods can sometimes be
7136-
// merged, so if we have multiple such calls, we defer tail calling.
7137-
//
7138-
// TODO: re-examine this; now that we're merging before morph we
7139-
// don't need to worry about interfering with merges.
7140-
//
7141-
if (call->IsNoReturn() && (optNoReturnCallCount > 1))
7135+
if (call->IsNoReturn() && !call->IsTailPrefixedCall())
71427136
{
7143-
failTailCall("Defer tail calling throw helper; anticipating merge");
7137+
// Such tail calls always throw an exception and we won't be able to see current
7138+
// Caller() in the stacktrace.
7139+
failTailCall("Never returns");
71447140
return nullptr;
71457141
}
71467142

0 commit comments

Comments
 (0)