Repository navigation
Deduplicator; add case when both methods fold into a third - #137572
Merged
MichalStrehovsky merged 1 commit intoNov 16, 2026
Merged
MichalStrehovsky merged 1 commit into
MichalStrehovsky merged 1 commit into
Conversation
|
Azure Pipelines: Successfully started running 3 pipeline(s). 12 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: @dotnet/crossgen-contrib |
This was referenced Nov 15, 2026
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change to compare relocation targets by their interned representatives.
No open issues 🎉
What changed in this PR
This PR improves NativeAOT method-body deduplication by recognizing equivalent relocation targets when both have folded into a shared third method, enabling additional code-size reductions.
Changes:
- Compare relocation targets by their interned representatives, preserving direct-fold comparisons while covering shared representatives.
- Update comments to describe the expanded equality behavior and its consistency with hashing.
| File | Description |
|---|---|
src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/MethodBodyDeduplicator.cs |
Adds representative-based target comparison and clarifies deduplication comments. |
Review effort: Balanced
This was referenced Nov 16, 2026
MichalStrehovsky
approved these changes
Nov 16, 2026
MichalStrehovsky
left a comment
Member
There was a problem hiding this comment.
Looks like up to 0.6% savings with StackTraceSupport=false. Nice, thanks!
Member
|
/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.
Working on AOT compilation of Cistern.ValueLinq I noticed that the folding of methods wasn't handling the case when both folded into a 3rd (i.e. the did A=B or A=C, but not B=C).
This minor change handles that case. For Cistern, a compilation of the corefx-linq based test suite (that Cistern carries a copy of), this results in a 5% reduction in the compiled size. There are much more modest, but not completely insignificant changes.
As an example crossgen2 was compiled (linux-x64, Release) with ilc built from baseline and from this change. Section sizes in bytes of the resulting object file.
--methodbodyfolding:generic(crossgen2's default):__managedcode.eh_frame.rodatanm)--methodbodyfolding:all:__managedcode.eh_frame.rodatanm)