Skip to content

Fix ILTrim field store dataflow - #134079

Merged
jtschuster merged 1 commit into
mainfrom
dev/jtschuster-copilot/ILTrim/field-store-dataflow
Sep 17, 2026
Merged

jtschuster merged 1 commit into
mainfrom
dev/jtschuster-copilot/ILTrim/field-store-dataflow

Conversation

@jtschuster

@jtschuster jtschuster commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Layer 1 of 12 in the ILTrim expected-failure reduction stack.

Propagate dataflow dependencies through field stores so the stored value is analyzed against the target field requirements.

Stack-top validation

  • Release ILTrim: 928 total, 424 passed, 504 skipped, 0 failed, 0 errors.
  • ./build.sh tools+tools.ilasm+tools.illinktests+tools.cdactests -test passed with 0 warnings and 0 errors.
  • ILCompiler.Compiler Release build passed with 0 warnings and 0 errors.

Stack created with GitHub Stacks CLI • Give Feedback 💬

Note

This PR description was generated by GitHub Copilot.

Include instance and static field stores when deciding whether to run dataflow analysis, allowing annotated field assignments to produce diagnostics.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: aefef8d7-5bed-4988-a4f8-6e1ff0f70510
@azure-pipelines

Copy link
Copy Markdown
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.

@jtschuster
jtschuster added this pull request to stack #134091 September 16, 2026 17:44
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

@jtschuster jtschuster changed the title dev/jtschuster copilot/ILTrim/field store dataflow Fix ILTrim field store dataflow Sep 16, 2026
@jtschuster
jtschuster requested a lite review from Copilot September 16, 2026 17:57

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.

🟢 Approval recommended

The reviewed changes are focused and have no unresolved blocking issues.

Pull request overview

Fixes ILTrim dataflow analysis for values stored into annotated fields.

Changes:

  • Detects stfld and stsfld field stores.
  • Removes five resolved expected failures.
File summaries
File Changes
src/coreclr/tools/ILTrim.Tests/ILTrimExpectedFailures.txt Removes resolved expected failures.
src/coreclr/tools/ILTrim.Core/DependencyAnalysis/MethodBodyNode.cs Triggers dataflow analysis for field stores.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

@jtschuster
jtschuster marked this pull request as ready for review September 16, 2026 18:25
@azure-pipelines

Copy link
Copy Markdown
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.

@jkotas jkotas added area-Tools-ILLink .NET linker development as well as trimming analyzers and removed area-ReadyToRun labels Sep 17, 2026
@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.

@am11

am11 commented Sep 17, 2026

Copy link
Copy Markdown
Member

Layer 1 of 12 in the ILTrim expected-failure reduction stack.

An issue would be nice with summary for this series.

@MichalStrehovsky

Copy link
Copy Markdown
Member

An issue would be nice with summary for this series.

ILTrim was our hackathon a couple years back (https://github.com/MichalStrehovsky/iltrim/pulls). The idea is to rebuild ILLink on top of the ILCompiler.TypeSystem, ILCompiler.DependencyAnalysis engine, and System.Reflection.Metadata that our AOT compilers are based on.

If stars align, we would be able to replace src/tools/illink with this and:

  • Stop maintaining Cecil
  • Get free type system features in the future (static abstracts, default interface methods, etc. had to be reimplemented in illink on top of Cecil)
  • Get rid of a lot of code that we currently duplicate in Cecil and managed type system (
    <!-- Common/Compiler shared files -->
    <ItemGroup>
    <Compile Include="..\Common\Compiler\DisplayNameHelpers.cs" Link="Shared\DisplayNameHelpers.cs" />
    <Compile Include="..\Common\Compiler\EventPseudoDesc.cs" Link="Shared\EventPseudoDesc.cs" />
    <Compile Include="..\Common\Compiler\PropertyPseudoDesc.cs" Link="Shared\PropertyPseudoDesc.cs" />
    <Compile Include="..\Common\Compiler\PseudoDescExtensions.cs" Link="Shared\PseudoDescExtensions.cs" />
    <Compile Include="..\Common\Compiler\Dataflow\DynamicallyAccessedMembersBinder.cs" Link="Shared\Dataflow\DynamicallyAccessedMembersBinder.cs" />
    <Compile Include="..\Common\Compiler\Dataflow\EcmaExtensions.cs" Link="Shared\Dataflow\EcmaExtensions.cs" />
    <Compile Include="..\Common\Compiler\Dataflow\GenericParameterProxy.cs" Link="Shared\Dataflow\GenericParameterProxy.cs" />
    <Compile Include="..\Common\Compiler\Dataflow\MethodProxy.cs" Link="Shared\Dataflow\MethodProxy.cs" />
    <Compile Include="..\Common\Compiler\Dataflow\ParameterProxy.cs" Link="Shared\Dataflow\ParameterProxy.cs" />
    <Compile Include="..\Common\Compiler\Dataflow\TypeProxy.cs" Link="Shared\Dataflow\TypeProxy.cs" />
    <Compile Include="..\Common\Compiler\Dataflow\TypeExtensions.cs" Link="Shared\Dataflow\TypeExtensions.cs" />
    <Compile Include="..\Common\Compiler\DependencyAnalysis\INodeWithRuntimeDeterminedDependencies.cs" Link="Shared\INodeWithRuntimeDeterminedDependencies.cs" />
    <Compile Include="..\Common\Compiler\ProcessLinkerXmlBase.cs" Link="Shared\ProcessLinkerXmlBase.cs" />
    <Compile Include="..\Common\Compiler\FeatureSettings.cs" Link="Shared\FeatureSettings.cs" />
    <Compile Include="..\Common\Compiler\TypeExtensions.cs" Link="Shared\TypeExtensions.cs" />
    <Compile Include="..\Common\Compiler\TypePreserve.cs" Link="Shared\TypePreserve.cs" />
    <Compile Include="..\Common\Compiler\DependencyTrackingLevel.cs" Link="Shared\DependencyTrackingLevel.cs" />
    <Compile Include="..\Common\System\Collections\Generic\ArrayBuilder.cs" Link="Shared\ArrayBuilder.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\DescriptorMarker.cs" Link="Shared\DescriptorMarker.cs"/>
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\DependencyAnalysis\ObjectGetTypeCalledNode.cs" Link="DependencyAnalysis\ObjectGetTypeCalledNode.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\DependencyAnalysis\ObjectGetTypeFlowDependenciesNode.cs" Link="DependencyAnalysis\ObjectGetTypeFlowDependenciesNode.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\DependencyAnalysis\TrimmingDescriptorNode.cs" Link="DependencyAnalysis\TrimmingDescriptorNode.cs" />
    </ItemGroup>
    <!-- ILCompiler.Compiler shared extension method files -->
    <ItemGroup>
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\CustomAttributeExtensions.cs" Link="Shared\CustomAttributeExtensions.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\AssemblyExtensions.cs" Link="Shared\AssemblyExtensions.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Logging\NativeAotFatalErrorException.cs" Link="Logging\NativeAotFatalErrorException.cs" />
    </ItemGroup>
    <!-- ILCompiler.Compiler shared Dataflow files -->
    <ItemGroup>
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\ArrayValue.cs" Link="Dataflow\ArrayValue.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\AttributeDataFlow.cs" Link="Dataflow\AttributeDataFlow.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\CompilerGeneratedCallGraph.cs" Link="Dataflow\CompilerGeneratedCallGraph.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\CompilerGeneratedState.cs" Link="Dataflow\CompilerGeneratedState.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\DiagnosticContext.cs" Link="Dataflow\DiagnosticContext.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\DiagnosticUtilities.cs" Link="Dataflow\DiagnosticUtilities.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\FieldReferenceValue.cs" Link="Dataflow\FieldReferenceValue.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\FieldValue.cs" Link="Dataflow\FieldValue.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\FlowAnnotations.cs" Link="Dataflow\FlowAnnotations.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\GenericArgumentDataFlow.cs" Link="Dataflow\GenericArgumentDataFlow.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\GenericParameterValue.cs" Link="Dataflow\GenericParameterValue.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\HandleCallAction.cs" Link="Dataflow\HandleCallAction.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\HoistedLocalKey.cs" Link="Dataflow\HoistedLocalKey.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\InterproceduralState.cs" Link="Dataflow\InterproceduralState.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\LocalVariableReferenceValue.cs" Link="Dataflow\LocalVariableReferenceValue.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\MethodBodyScanner.cs" Link="Dataflow\MethodBodyScanner.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\MethodParameterValue.cs" Link="Dataflow\MethodParameterValue.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\MethodReturnValue.cs" Link="Dataflow\MethodReturnValue.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\ParameterReferenceValue.cs" Link="Dataflow\ParameterReferenceValue.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\ReferenceValue.cs" Link="Dataflow\ReferenceValue.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\ReflectionMarker.cs" Link="Dataflow\ReflectionMarker.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\ReflectionMethodBodyScanner.cs" Link="Dataflow\ReflectionMethodBodyScanner.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\RequireDynamicallyAccessedMembersAction.cs" Link="Dataflow\RequireDynamicallyAccessedMembersAction.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\ScannerExtensions.cs" Link="Dataflow\ScannerExtensions.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\TrimAnalysisAssignmentPattern.cs" Link="Dataflow\TrimAnalysisAssignmentPattern.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\TrimAnalysisFieldAccessPattern.cs" Link="Dataflow\TrimAnalysisFieldAccessPattern.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\TrimAnalysisGenericInstantiationAccessPattern.cs" Link="Dataflow\TrimAnalysisGenericInstantiationAccessPattern.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\TrimAnalysisMethodCallPattern.cs" Link="Dataflow\TrimAnalysisMethodCallPattern.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\TrimAnalysisPatternStore.cs" Link="Dataflow\TrimAnalysisPatternStore.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\TrimAnalysisTokenAccessPattern.cs" Link="Dataflow\TrimAnalysisTokenAccessPattern.cs" />
    <Compile Include="..\aot\ILCompiler.Compiler\Compiler\Dataflow\ValueNode.cs" Link="Dataflow\ValueNode.cs" />
    </ItemGroup>
    ).

It's not a committed project at this point so there's no Epic issue or anything. We don't even have a bug tracker, the bug tracker is ILTrimExpectedFailures.txt.

This week is hackathon at Microsoft again.

@jtschuster
jtschuster removed this pull request from stack #134091 September 17, 2026 17:27
@jtschuster
jtschuster added this pull request to stack #134146 September 17, 2026 17:28
@jtschuster

Copy link
Copy Markdown
Member Author

/ba-g build analysis is hanging, but everything else is passing

@jtschuster
jtschuster merged commit ee851da into main Sep 17, 2026
124 checks passed
@jtschuster
jtschuster deleted the dev/jtschuster-copilot/ILTrim/field-store-dataflow branch September 17, 2026 22:28
@github-project-automation github-project-automation Bot moved this to Done in AppModel Sep 17, 2026
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 18, 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

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants