Skip to content

Conversation

AndyAyersMS
Copy link
Member

We may discover a TYP_BYREF local can point to stack objects, in which case it will remain a TYP_BYREF local, so no retyping is needed.

Fixes #116213

We may discover a TYP_BYREF local can point to stack objects, in which
case it will remain a TYP_BYREF local, so no retyping is needed.

Fixes dotnet#116213
@Copilot Copilot AI review requested due to automatic review settings June 3, 2025 19:08
@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jun 3, 2025
@AndyAyersMS
Copy link
Member Author

@jakobbotsch PTAL
cc @dotnet/jit-contrib

No diffs

Copy link
Contributor

@Copilot 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 adds logic to skip retyping for locals that are already TYP_BYREF and point to stack objects, clearing their tracked status instead.

  • Introduces an else branch in RewriteUses to log when no retyping is needed and clear lvTracked.
  • Avoids unnecessary retyping work during escape analysis.
Comments suppressed due to low confidence (1)

src/coreclr/jit/objectalloc.cpp:2809

  • Consider adding a unit test or JIT validation to exercise this new else branch, ensuring that when no retyping is needed, lvTracked is correctly cleared without side effects.
lclVarDsc->lvTracked = 0;

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

/ba-g unrelated installer build and test failure.

@AndyAyersMS AndyAyersMS merged commit ab30ec7 into dotnet:main Jun 3, 2025
108 of 110 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 4, 2025
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.

[libraries-pgo] Assertion failed 'newType == TYP_I_IMPL' during 'Allocate Objects' in System.Memory.Tests

2 participants