Remove PHASE_MERGE_THROWS#129084
Open
EgorBo wants to merge 5 commits into
Open
Conversation
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the standalone throw-block tail-merge phase (PHASE_MERGE_THROWS / Compiler::fgTailMergeThrows) and folds its intent into the existing PHASE_HEAD_TAIL_MERGE implementation, expanding terminal (return/throw) tail-merging behavior.
Changes:
- Adjusts
fgHeadTailMergeto apply the predecessor-count cap only for common-successor tail merges, and to retry terminal (return/throw) merges until no more groups are found. - Deletes
fgTailMergeThrowsand all related plumbing (phase entry, mem kind, compiler.h declaration, phase invocation). - Removes the
PHASE_MERGE_THROWSphase name andTailMergeThrowsallocation kind.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/coreclr/jit/fgopt.cpp | Updates head/tail merge to retry terminal merges and exempts terminal merges from the pred-count cap. |
| src/coreclr/jit/fgehopt.cpp | Removes the old fgTailMergeThrows implementation entirely. |
| src/coreclr/jit/compphases.h | Removes PHASE_MERGE_THROWS from the phase list. |
| src/coreclr/jit/compmemkind.h | Removes TailMergeThrows memory kind. |
| src/coreclr/jit/compiler.h | Removes the fgTailMergeThrows declaration. |
| src/coreclr/jit/compiler.cpp | Removes the DoPhase(... PHASE_MERGE_THROWS ...) invocation. |
# Conflicts: # src/coreclr/jit/fgopt.cpp
Bounds the terminal-block merge work instead of leaving it unlimited. 2x (100) is the minimal multiple that avoids code-size regressions vs the fgTailMergeThrows baseline (SPMI asmdiffs over libraries.pmi/benchmarks/aspnet); 1x regresses +5,982 bytes on libraries.pmi. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Jun 7, 2026
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.
PHASE_HEAD_TAIL_MERGE fully covers what PHASE_MERGE_THROWS did. Had to bump the threshold to cover some regressions.
-13kb diffs on win-x64