Skip to content

JIT: remember indir store addresses in escape analysis #115689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

AndyAyersMS
Copy link
Member

Instead of analyzing the indir store address when we are processing the stored value, save off the address bvIndex when processing the address.

Instead of analyzing the indir store address when we are processing
the stored value, save off the address bvIndex when processing the
address.
@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 May 18, 2025
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

x86 failures seem unrelated. I have another unrelated PR going so will see if they turn up there too.

@AndyAyersMS AndyAyersMS marked this pull request as ready for review May 19, 2025 15:16
@Copilot Copilot AI review requested due to automatic review settings May 19, 2025 15:16
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 refactors the escape analysis in the JIT by recording the indir store addresses during analysis and adjusting conditions for handling GT_BLK instructions.

  • Introduces a new NodeToIndexMap in objectalloc.h and a corresponding instance in ObjectAllocator.
  • Adjusts escape analysis logic in objectalloc.cpp, including changes to conditionals in GT_STOREIND and GT_IND/GT_BLK handling.
  • Adds a new CONFIG_INTEGER for dumping the connection graph in jitconfigvalues.h.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/coreclr/jit/objectalloc.h Added NodeToIndexMap typedef and new member for address indexing
src/coreclr/jit/objectalloc.cpp Updated escape analysis logic, including GT_STOREIND and GT_BLK handling
src/coreclr/jit/jitconfigvalues.h Added configuration option for dumping the connection graph

{
// If we are loading from a GC struct field, we may need to retype the load
//
if (retypeFields && (tree->OperIs(GT_FIELD_ADDR)) && (varTypeIsGC(parent->TypeGet())))
if (retypeFields && (varTypeIsGC(parent->TypeGet())))
Copy link
Preview

Copilot AI May 19, 2025

Choose a reason for hiding this comment

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

The updated retyping condition no longer checks for GT_FIELD_ADDR as it did previously, which may modify the intended behavior for retyping GC struct field loads. Please review to ensure this change is aligned with the intended analysis logic.

Suggested change
if (retypeFields && (varTypeIsGC(parent->TypeGet())))
if (retypeFields && parent->OperIs(GT_FIELD_ADDR) && varTypeIsGC(parent->TypeGet()))

Copilot uses AI. Check for mistakes.

@AndyAyersMS
Copy link
Member Author

@jakobbotsch PTAL
cc @dotnet/jit-contrib

Not (yet) a full rewrite of the connection graph analysis, but puts it in a simpler form.

Minimal diffs; we now prove a few more arrays don't escape.

@AndyAyersMS
Copy link
Member Author

/ba-g timeout in x86 libraries test

@AndyAyersMS AndyAyersMS merged commit 0d90354 into dotnet:main May 19, 2025
104 of 109 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.

2 participants