Skip to content
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/coreclr/jit/fgbasic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2719,11 +2719,11 @@ unsigned Compiler::fgMakeBasicBlocks(const BYTE* codeAddr, IL_OFFSET codeSize, F
BADCODE3("tail call not followed by ret", " at offset %04X", (IL_OFFSET)(codeAddr - codeBegp));
}

if (fgCanSwitchToOptimized() && fgMayExplicitTailCall())
if (fgCanSwitchToOptimized() && fgMayExplicitTailCall() &&
((info.compFlags & CORINFO_FLG_DISABLE_TIER0_FOR_LOOPS) != 0))
{
// Method has an explicit tail call that may run like a loop or may not be generated as a tail
// call in tier 0, switch to optimized to avoid spending too much time running slower code and
// to avoid stack overflow from recursion
// call in tier 0, switch to optimized to avoid spending too much time running slower code
fgSwitchToOptimized();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought it might be a good idea to go back to what you had before -- jitting these requires creating up to two IL stubs for each explicit tailcall in the function, and those stubs are not currently shared, so the rejit will always recreate them.

}
}
Expand Down