Skip to content

JIT: Simplify gtHasLocalsWithAddrOp - #131756

Closed
jakobbotsch wants to merge 1 commit into
dotnet:mainfrom
jakobbotsch:simplify-gtHasLocalsWithAddrOp
Closed

JIT: Simplify gtHasLocalsWithAddrOp#131756
jakobbotsch wants to merge 1 commit into
dotnet:mainfrom
jakobbotsch:simplify-gtHasLocalsWithAddrOp

Conversation

@jakobbotsch

Copy link
Copy Markdown
Member

In all places that use this we only need to check for LCL_VAR and LCL_FLD, and this simplifies multiple callers that workaround this returning true for LCL_ADDR nodes.

Alternative to #131754.

In all places that use this we only need to check for LCL_VAR and
LCL_FLD, and this simplifies multiple callers that workaround this
returning true for `LCL_ADDR` nodes.
Copilot AI review requested due to automatic review settings August 3, 2026 16:19
@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 Aug 3, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 pipeline(s).
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

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.

Pull request overview

This PR refines the JIT helper that detects references to locals involved in address operations by narrowing it to value uses (GT_LCL_VAR / GT_LCL_FLD) and updating all call sites to use the new semantics.

Changes:

  • Replace gtHasLocalsWithAddrOp with gtHasLocalValueWithAddrOp, excluding GT_LCL_ADDR and local stores from consideration.
  • Update importer, indirect-call transformation, and FG optimization logic to use the new helper and drop now-unnecessary special-casing.
  • Adjust documentation/comments around the helper to reflect the new, narrower contract.

Reviewed changes

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

Show a summary per file
File Description
src/coreclr/jit/indirectcalltransformer.cpp Uses the new helper to avoid conservatively spilling args based on GT_LCL_ADDR.
src/coreclr/jit/importer.cpp Simplifies spill / interference / inline-arg classification checks to align with value-only local detection.
src/coreclr/jit/gentree.cpp Renames and tightens the tree-walk helper to only consider GT_LCL_VAR/GT_LCL_FLD nodes.
src/coreclr/jit/fgopt.cpp Updates early-reordering logic to synthesize GTF_GLOB_REF based on the refined helper.
src/coreclr/jit/compiler.h Renames the helper declaration to match the new API.

Comment thread src/coreclr/jit/gentree.cpp
@jakobbotsch

Copy link
Copy Markdown
Member Author

Not that simple since the tree can have indirections of a local address too, which we need to check for, so this just moves the complexity into gtHasLocalsWithAddrOp.

@jakobbotsch jakobbotsch closed this Aug 4, 2026
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