ILTrim: Remove unused beforefieldinit constructors - #133900
Merged
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4b4a86d7-8e66-47b9-a80c-e85663683aba
|
Azure Pipelines: Successfully started running 4 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 |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review issues remain.
Pull request overview
Fixes ILTrim dependency tracking so unused beforefieldinit constructors and static fields can be removed safely.
Changes:
- Adjusts static-constructor retention rules.
- Tracks dependencies from retained static fields.
- Removes resolved expected failures.
File summaries
| File | Summary |
|---|---|
src/coreclr/tools/ILTrim.Tests/ILTrimExpectedFailures.txt |
Removes resolved expected failures. |
src/coreclr/tools/ILTrim.Core/DependencyAnalysis/TokenBased/TypeDefinitionNode.cs |
Applies BeforeFieldInit optimization when retaining static constructors. |
src/coreclr/tools/ILTrim.Core/DependencyAnalysis/TokenBased/FieldDefinitionNode.cs |
Links retained static fields to their type initializer. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
MichalStrehovsky
approved these changes
Sep 14, 2026
Member
Author
|
/ba-g Build analysis is hanging but the only failure is known. |
jtschuster
enabled auto-merge (squash)
September 14, 2026 23:39
jtschuster
added a commit
to jtschuster/runtime
that referenced
this pull request
Sep 18, 2026
## Summary Fix ILTrim's static-constructor dependency tracking so unused `beforefieldinit` static constructors and their unused static fields can be removed, while preserving explicit static constructors and constructors required by retained static fields. This fixes `Generics.GenericConstraints` and clears three additional stale expected-failure entries exposed by the same correction. > [!NOTE] > This pull request description was generated with GitHub Copilot.
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.
Summary
Fix ILTrim's static-constructor dependency tracking so unused
beforefieldinitstatic constructors and their unused static fields can be removed, while preserving explicit static constructors and constructors required by retained static fields.This fixes
Generics.GenericConstraintsand clears three additional stale expected-failure entries exposed by the same correction.Validation
./build.sh clr.toolstests -testNote
This pull request description was generated with GitHub Copilot.