JIT: Fix empty-block cycle hang - #132795
Merged
Merged
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
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. |
Member
Author
|
@jakobbotsch PTAL Fixes a fuzzing-created example; haven't seen this in real code. |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates CoreCLR JIT flow-graph optimization to avoid non-terminating rewrites when a branch targets an empty BBJ_ALWAYS block that participates in an empty-block cycle, and adds a focused regression test to cover the hang scenario.
Changes:
- Extend
fgOptimizeBranchToEmptyUnconditionalto detect cycles in empty unconditional chains (using a slow/fast pointer walk) and suppress the redirect when a cycle is found. - Add a new JitBlue regression test project
Runtime_132785that runs withDOTNET_TieredCompilation=0to ensure the optimizing JIT path is exercised deterministically.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/coreclr/jit/fgopt.cpp | Prevents repeated edge redirection around empty-block cycles so flow optimization terminates. |
| src/tests/JIT/Regression/JitBlue/Runtime_132785/Runtime_132785.csproj | Adds isolated JIT regression test project configuration, including tiered compilation disabled. |
| src/tests/JIT/Regression/JitBlue/Runtime_132785/Runtime_132785.cs | Adds an xUnit-based repro-derived test that asserts the expected result and guards against the compilation hang. |
2 tasks
jakobbotsch
reviewed
Aug 27, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Conflicts: # src/tests/JIT/Regression/Regression_ro_2.csproj
jakobbotsch
approved these changes
Aug 27, 2026
Member
Author
|
/ba-g OSX timeouts |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #132785.
fgOptimizeBranchToEmptyUnconditionalonly recognized two-block empty cycles. Detect any empty unconditional cycle before redirecting the edge so flow optimization terminates.Adds the regression test to the shared JIT regression runner and uses
AggressiveOptimizationto exercise FullOpts.Validation:
Regression_ro_2buildjit-formatNote
This pull request description was generated by GitHub Copilot.