Skip to content

JIT: handle x86 tail call via helper when control expression is spilled - #120272

Merged
AndyAyersMS merged 3 commits into
dotnet:mainfrom
AndyAyersMS:Fix120170
Oct 21, 2025
Merged

JIT: handle x86 tail call via helper when control expression is spilled#120272
AndyAyersMS merged 3 commits into
dotnet:mainfrom
AndyAyersMS:Fix120170

Conversation

@AndyAyersMS

Copy link
Copy Markdown
Member

Make sure we order the control expression after the spill.

Also add a range control to selectively enable instrumentation stress.

Fixes#120170.

Make sure we order the control expression after the spill.
Also add a range control to selectively enable instrumentation stress.
Fixesdotnet#120170.
CopilotAI review requested due to automatic review settings September 30, 2025 19:41

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug in the JIT compiler's handling of x86 tail calls via helper functions when the control expression gets spilled to a temporary variable. The fix ensures proper ordering of code by inserting the call target range before the call rather than after an argument, and then reordering all putargs to be adjacent to the call.

  • Moves call target range insertion from after arg0 to before the call in LowerTailCallViaJitHelper
  • Adds a call to MoveCFGCallArgs to properly reorder putargs after the range insertion
  • Introduces a new configuration option JitInstrumentIfOptimizingRange to selectively control instrumentation stress testing

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

FileDescription
src/coreclr/jit/lower.cppUpdates tail call lowering logic to handle spilled control expressions by changing insertion order and adding putarg reordering
src/coreclr/jit/jitconfigvalues.hAdds new configuration string for instrumentation range control
src/coreclr/jit/compiler.cppImplements range-based filtering for the instrumentation optimization feature

@github-actionsgithub-actionsBot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Sep 30, 2025
@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

@jakobbotsch PTAL
cc @dotnet/jit-contrib

Small handful of diffs.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-coreclr pgostress, runtime-coreclr libraries-pgo

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

Remaining failures look like timeouts / stackoverflow tester.

Tier1+instr is likely fairly slow; I wonder if we should invest in making it faster.

Comment threadsrc/coreclr/jit/lower.cpp Outdated
Comment threadsrc/coreclr/jit/lower.cpp Outdated
@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

/azp run runtime-coreclr pgostress, runtime-coreclr libraries-pgo

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

@AndyAyersMS

Copy link
Copy Markdown
MemberAuthor

pgostress failure is #110173

libraries-pgo is a bit messy, but failures are either timeouts (#120902), ooms (#120918), or one failure that seems timing related and unrelated to this PR:

x64 windows
DOTNET_JitDelegateProfiling=1
DOTNET_JitVTableProfiling=1
DOTNET_ReadyToRun=0
DOTNET_TC_QuickJitForLoops=1
DOTNET_TieredCompilation=1
DOTNET_TieredPGO=1
Starting: System.Transactions.Local.Tests (parallel test collections = on [4 threads], stop on fail = off
System.Transactions.Tests.TransactionManagerTest.DefaultTimeout_MaxTimeout_Set_Get [FAIL]
Assert.Equal() Failure: Values differ
Expected: 00:02:00
Actual: 00:01:00

@AndyAyersMS
AndyAyersMS merged commit 2cca056 into dotnet:mainOct 21, 2025
126 of 134 checks passed
@jakobbotschjakobbotsch mentioned this pull request Nov 17, 2025
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Nov 20, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test failure: JIT/Regression/JitBlue/Runtime_72845/Runtime_72845/Runtime_72845.cmd

3 participants

@AndyAyersMS@jakobbotsch