Repository navigation
JIT: clear BBF_DONT_REMOVE on the new preheader in loop inversion - #136043
Merged
lewing merged 3 commits intoOct 19, 2026
Merged
Conversation
…sm control flow Loop inversion splits a catch handler entry with fgSplitBlockAtEnd; the new preheader inherits BBF_DONT_REMOVE. If the loop later becomes unreachable, fgRemoveBlocksOutsideDfsTree keeps that block as an empty throw, and Wasm control flow (which lays out only DFS blocks) asserts that block order disagrees with preorder numbers. Before removing unreachable blocks for Wasm, clear BBF_DONT_REMOVE on unreachable blocks that are not EH region entries or call-finally pairs. Fixes dotnet#136041 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1324801d-f940-4cf8-83cc-634c4510d91f
|
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. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1324801d-f940-4cf8-83cc-634c4510d91f
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Replace the Wasm-only unreachable block cleanup with a fix at the source. Loop inversion splits the preheader with fgSplitBlockAtEnd, and the new preheader inherits BBF_DONT_REMOVE. When the old preheader is a handler entry and the loop later becomes unreachable, the new block can't be removed. Other targets emit it as a dead throw; Wasm control flow asserts. The old preheader keeps its EH entry role, so the new block doesn't need the flag. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1324801d-f940-4cf8-83cc-634c4510d91f
lewing
marked this pull request as ready for review
October 19, 2026 01:52
EgorBo
approved these changes
Oct 19, 2026
lewing
enabled auto-merge (squash)
October 19, 2026 22:42
Member
Author
|
/ba-g failure looks like a very rare reoccurrence of #116753 not worth reopening unless it recurs more than once every 6+ months |
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.
Loop inversion splits the preheader with
fgSplitBlockAtEnd, and the new preheader inheritsBBF_DONT_REMOVE. When the old preheader is a catch handler entry and the loop condition later folds to false, the new block becomes unreachable but can't be removed. On Wasm its stalebbPreorderNumtripsblock order disagrees with preorder numinfgWasmControlFlow; other targets emit a deadint3/brk.The old preheader stays the EH entry, so this clears the flag on the new block, as the OSR entry code in
fgopt.cppdoes.fgSplitBlockAtEnditself must keep copying the flag, because loop canonicalization relies on it when splitting try entries.Resolves #136041
SuperPMI: diffs (dead throw removals only)
Note
This PR description was drafted with GitHub Copilot.