Skip to content

Support for variable sized locals in morph and lclmorph#124516

Open
snickolls-arm wants to merge 6 commits intodotnet:mainfrom
snickolls-arm:local-morph
Open

Support for variable sized locals in morph and lclmorph#124516
snickolls-arm wants to merge 6 commits intodotnet:mainfrom
snickolls-arm:local-morph

Conversation

@snickolls-arm
Copy link
Contributor

Adds handling for unknown compile-time sizes to morph related to indirections and addressing of variables and struct fields.

LCL_ADDR is allowed for TYP_SIMD/TYP_MASK if the address offset is zero, as this is the only offset that is provably within bounds for something with an unknown size at compile time.

We can only reduce ADD(LCL_ADDR(BASE), OFFSET) for such locals when BASE and OFFSET are zero.

We only process STOREIND or IND as STORE_LCL_FLD/LCL_FLD if the indirection points to the entire variable (the indirection offset is zero and the ValueSizes are equivalent).

Adds handling for unknown compile-time sizes to morph related to indirections and
addressing of variables and struct fields.

LCL_ADDR is allowed for TYP_SIMD/TYP_MASK if the address offset is zero, as this
is the only offset that is provably within bounds for something with an unknown size
at compile time.

We can only reduce ADD(LCL_ADDR(BASE), OFFSET) for such locals when BASE and OFFSET
are zero.

We only process STOREIND or IND as STORE_LCL_FLD/LCL_FLD if the indirection points
to the entire variable (the indirection offset is zero and the ValueSizes are
equivalent).
@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 Feb 17, 2026
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Feb 17, 2026
@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.

@snickolls-arm
Copy link
Contributor Author

@dotnet/arm64-contrib @dotnet/jit-contrib

@snickolls-arm
Copy link
Contributor Author

There are some regressions in the diffs causing by spilling registers to stack, which I think might indicate some accesses are incorrectly labelled as address exposed. Looking into this as this shouldn't show any diffs to baseline compilation, it should only affect TYP_SIMD.

* Add IsWideAccess for determining whether an access should make a local
  address-exposed.
* Refactor existing bounds checking logic to use IsWideAccess.
* Add handling or types that don't have sizes at compile-time. Such types
  can check whether an access is entire using IsEntireAccess and set them
  address-exposed if this is not the case.
* Separate some handling for zero-sized indirections into explicit
  comparisons.
@snickolls-arm
Copy link
Contributor Author

My latest commits have reversed the diffs, it was to do with implicit handling of zero-sized indirections that I missed the first time around. While I'm in the area I've cleaned up a TODO, and made some of the various bounds checking over morph use similar logic.

@dotnet/arm64-contrib please could I have a review?

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 community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant