Skip to content

Conversation

@AndyAyersMS
Copy link
Member

Retype GT_STOREIND based on the store address, not the store data, since we need to know if we are retyping fields, and only know that when propagating from the local that forms the store address.

Fixes #111922.

Retype GT_STOREIND based on the store address, not the store data, since
we need to know if we are retyping fields, and only know that when
propagating from the local that forms the store address.

Fixes dotnet#111922.
@Copilot Copilot AI review requested due to automatic review settings April 23, 2025 18:00
@ghost ghost added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Apr 23, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a retyping error in the JIT's object stack allocation by basing the retyping decision on the store address rather than the store data. Key changes include:

  • Addition of a test case in Retyping.cs to validate the fix.
  • Removal of an assertion and restructuring of the condition in objectalloc.cpp to check the field address on the tree node.
  • Minor comment update for clarity in the core JIT code.

Reviewed Changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
src/tests/JIT/opt/ObjectStackAllocation/Retyping.cs Added test case for verifying correct retyping of store instructions.
src/coreclr/jit/objectalloc.cpp Modified retyping logic by removing an assertion and checking the field address on tree.
Files not reviewed (1)
  • src/tests/JIT/opt/ObjectStackAllocation/Retyping.csproj: Language not supported
Comments suppressed due to low confidence (1)

src/coreclr/jit/objectalloc.cpp:2045

  • Please verify that replacing the original check using parent's AsIndir()->Addr() with tree->OperIs(GT_FIELD_ADDR) adequately covers all cases for retyping GC struct fields.
if (retypeFields && parent->OperIs(GT_STOREIND) && tree->OperIs(GT_FIELD_ADDR) &&

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@AndyAyersMS
Copy link
Member Author

Need to revise this further.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

System.Collections.Test: Assert failure '!CREATE_CHECK_STRING(bSmallObjectHeapPtr || bLargeObjectHeapPtr)'

1 participant