JIT: fix double reporting of some failures in the inline tree#118902
Merged
AndyAyersMS merged 2 commits intomainfrom Aug 20, 2025
Merged
JIT: fix double reporting of some failures in the inline tree#118902AndyAyersMS merged 2 commits intomainfrom
AndyAyersMS merged 2 commits intomainfrom
Conversation
We now eagerly create inlinee contexts when we try and inline, so in post-inline debug when we go to scan the trees for the calls that remain, we need to remember which ones were failed inline candidates and which ones we were never inline candidates.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in the JIT compiler where some inline failures were being double-reported in debug builds. The fix adds tracking to distinguish between calls that were considered for inlining but failed versus calls that were never inline candidates.
Key changes:
- Adds a new debug flag to track failed inline candidates
- Updates inline failure handling to mark calls that were attempted but failed
- Modifies post-inline debug scanning to avoid double-reporting
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/coreclr/jit/gentree.h | Adds GTF_CALL_MD_WAS_CANDIDATE flag and accessor methods for tracking failed inline candidates |
| src/coreclr/jit/fginline.cpp | Sets the new flag on inline failures and updates debug scanning logic to check for it |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Member
Author
|
For a simple test case #using System.Runtime.CompilerServices;
X.Test();
class X
{
static int sum()
{
int sum = 0;
for (int i = 0; i < 100; i++)
{
sum += i;
}
return sum;
}
[MethodImpl(MethodImplOptions.NoInlining)]
static int bar() => 3;
[MethodImpl(MethodImplOptions.NoInlining)]
public static int Test()
{
return sum() + bar() + sum();
}
}and with a checked build and we used to print and now print @dotnet/jit-contrib PTAL Debug only change; no diffs. |
EgorBo
approved these changes
Aug 20, 2025
Member
Author
|
/ba-g host activation tests failed but no log to match on in one case |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We now eagerly create inlinee contexts when we try and inline, so in post-inline debug when we go to scan the trees for the calls that remain, we need to remember which ones were failed inline candidates and which ones we were never inline candidates.