Repository navigation
JIT: fix asserts in fgRemoveUnreachableTry - #130003
Merged
Merged
Conversation
Ensure apparently reachable regions enclosed in an unreachable region are also correctly removed. Consistently update region ends when fgRemoveBlock removes an unreachable block. Fixes dotnet#129970, dotnet#129971, dotnet#129972. Co-authored-by: Copilot <[email protected]>
Member
Author
|
@jakobbotsch PTAL |
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates JIT EH cleanup to more robustly remove unreachable EH regions (including regions structurally enclosed within an unreachable region), and ensures EH region “last block” boundaries are kept consistent when unreachable blocks are removed—preventing verifier/assert failures in fgRemoveUnreachableTry.
Changes:
- Update
Compiler::fgRemoveUnreachableTryto track “dead” EH regions via a bitvector, propagate death through structural containment, clear stale try/handler indices, and remove EH entries from highest-to-lowest. - Update
Compiler::fgRemoveBlockto retarget EH region end blocks when removing an unreachable block. - Add three JIT regression tests and wire them into the JIT regression project.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/jit/fgehopt.cpp | Reworks unreachable-EH removal to also drop transitively dead (structurally enclosed) regions and to remove EH entries in a safer order. |
| src/coreclr/jit/fgbasic.cpp | Updates EH “last block” bookkeeping when an unreachable block is removed. |
| src/tests/JIT/Regression/Regression_ro_2.csproj | Includes the new regression tests in the build. |
| src/tests/JIT/Regression/JitBlue/Runtime_129970/Runtime_129970.cs | Adds regression test coverage for one of the reported fgRemoveUnreachableTry assertion scenarios. |
| src/tests/JIT/Regression/JitBlue/Runtime_129971/Runtime_129971.cs | Adds regression test coverage for the reported fgRemoveBlock assertion scenario during unreachable-try removal. |
| src/tests/JIT/Regression/JitBlue/Runtime_129972/Runtime_129972.cs | Adds regression test coverage for the reported filter/DFS-related assertion scenario during unreachable-try removal. |
jakobbotsch
approved these changes
Jun 29, 2026
Member
Author
|
Pops, mean to run Fuzzlyn again. Will queue one up in main in a bit. |
eiriktsarpalis
pushed a commit
that referenced
this pull request
Jul 15, 2026
Ensure apparently reachable regions enclosed in an unreachable region are also correctly removed. Consistently update region ends when fgRemoveBlock removes an unreachable block. Fixes #129970, #129971, #129972. Co-authored-by: Copilot <[email protected]>
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.
Ensure apparently reachable regions enclosed in an unreachable region are also correctly removed. Consistently update region ends when fgRemoveBlock removes an unreachable block.
Fixes #129970, #129971, #129972.