Skip to content

Use MoveToImmutable in ILLink.RoslynAnalyzer - #135107

Merged
sbomer merged 2 commits into
dotnet:mainfrom
prozolic:pr-illink
Oct 13, 2026
Merged

sbomer merged 2 commits into
dotnet:mainfrom
prozolic:pr-illink

Conversation

@prozolic

@prozolic prozolic commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Update ImmutableArray<T>.Builder usages in ILLink.RoslynAnalyzer and ILLink.Shared to call MoveToImmutable instead of ToImmutableArray. As a follow-up to PR #134426, this applies the changes made in ILLink and ILCompiler.Compiler to ILLink.RoslynAnalyzer and ILLink.Shared as well.

./build.cmd -s libs.sfx -c Release /p:ToolsConfiguration=Debug
dotnet test src/tools/illink/test/ILLink.RoslynAnalyzer.Tests/ILLink.RoslynAnalyzer.Tests.csproj -c Debug
dotnet test src/coreclr/tools/aot/ILCompiler.Trimming.Tests/ILCompiler.Trimming.Tests.csproj -c Release

Update ImmutableArray<T>.Builder usages in ILLink.RoslynAnalyzer to
call MoveToImmutable instead of ToImmutable/ToImmutableArray.
As a follow-up to PR dotnet#134426, this applies the changes made in
ILLink and ILCompiler.Compiler to ILLink.RoslynAnalyzer as well.
@github-actions github-actions Bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Oct 2, 2026
@dotnet-policy-service dotnet-policy-service Bot added linkable-framework Issues associated with delivering a linker friendly framework community-contribution Indicates that the PR has been added by a community member labels Oct 2, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke, @dotnet/illink
See info in area-owners.md if you want to be subscribed.

@prozolic
prozolic marked this pull request as ready for review October 2, 2026 16:02
Copilot AI balanced review requested due to automatic review settings October 2, 2026 16:02
@prozolic
prozolic requested a review from sbomer as a code owner October 2, 2026 16:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The performance-only change lacks the repository-required before-and-after measurement evidence.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Replaces copying immutable-array conversions with zero-copy transfers where builder capacity exactly matches item count.

Changes:

  • Uses MoveToImmutable() across analyzer/shared trimming paths.
  • Preallocates argument builders with exact capacities.
  • Aligns analyzer implementations with ILLink and ILCompiler counterparts.
File Description
HandleCallAction.cs Transfers generic-parameter values without copying.
TypeProxy.cs Transfers type generic parameters without copying.
TrimAnalysisMethodCallPattern.cs Preallocates and transfers argument arrays.
MethodProxy.cs Transfers method generic parameters without copying.

@prozolic

Copy link
Copy Markdown
Contributor Author

@sbomer Thanks for the approval. Is there anything else I should do?

@sbomer

sbomer commented Oct 13, 2026

Copy link
Copy Markdown
Member

Nope, thanks for the ping! I will merge it.

@sbomer
sbomer merged commit 8a4ea22 into dotnet:main Oct 13, 2026
88 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Tools-ILLink .NET linker development as well as trimming analyzers community-contribution Indicates that the PR has been added by a community member linkable-framework Issues associated with delivering a linker friendly framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants