Skip to content

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

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

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

Conversation

@AndyAyersMS
Copy link
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.

Fixes dotnet#120170.
Copilot AI review requested due to automatic review settings September 30, 2025 19:41
Copy link
Contributor

Copilot AI left a comment

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.

File Description
src/coreclr/jit/lower.cpp Updates tail call lowering logic to handle spilled control expressions by changing insertion order and adding putarg reordering
src/coreclr/jit/jitconfigvalues.h Adds new configuration string for instrumentation range control
src/coreclr/jit/compiler.cpp Implements range-based filtering for the instrumentation optimization feature

@github-actions github-actions bot 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
Member Author

@jakobbotsch PTAL
cc @dotnet/jit-contrib

Small handful of diffs.

@dotnet-policy-service
Copy link
Contributor

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

@AndyAyersMS
Copy link
Member Author

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

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@AndyAyersMS
Copy link
Member Author

Remaining failures look like timeouts / stackoverflow tester.

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

@AndyAyersMS
Copy link
Member Author

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

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@AndyAyersMS
Copy link
Member Author

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:main Oct 21, 2025
126 of 134 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 20, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR 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

2 participants