Repository navigation
Conversation
When a backedge source can't have a patchpoint (non-empty IL stack or in a handler), the importer should place one at the backedge target instead, but the check was inverted so it only fired when the target already had a patchpoint. Loops like 'while (i < (flag ? a : b))' got no patchpoint and stayed in Tier0. Fix the check. Since the target's entry stack may not be known yet when the source is imported, also drop the patchpoint when the target turns out to have a non-empty entry stack. Fixes dotnet#135818 Co-authored-by: Copilot <[email protected]> Copilot-Session: 6ec7c151-8b7f-4bf9-8b1a-8c601a2965ec
|
Azure Pipelines: Successfully started running 5 pipeline(s). 11 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The regression assertion verifies arithmetic but cannot detect missing OSR patchpoints.
1 open finding
What changed in this PR
Fixes fallback OSR patchpoint placement so affected loops can leave Tier0.
Changes:
- Corrects the inverted check for backedge-target patchpoints.
- Removes requested patchpoints when the target’s entry stack is non-empty.
- Adds a regression scenario for a conditional loop bound.
Builds and tests were not run.
| File | Description |
|---|---|
| src/tests/JIT/Regression_ro_2/Runtime_135818.cs | Adds the conditional-loop regression scenario. |
| src/coreclr/jit/importer.cpp | Corrects target patchpoint placement and entry-stack validation. |
🧠 Review effort: Balanced
This was referenced Oct 15, 2026
Closed
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.

When a backedge source can't have a patchpoint (non-empty IL stack or in a handler), the importer should place one at the backedge target instead, but the check was inverted so it only fired when the target already had a patchpoint. Loops like 'while (i < (flag ? a : b))' got no patchpoint and stayed in Tier0.
Fix the check. Since the target's entry stack may not be known yet when the source is imported, also drop the patchpoint when the target turns out to have a non-empty entry stack.
Fixes #135818
Several diffs (OSR patchpoints; SPMI replay failures)