JIT: Propagate class handle when split tree#128485
Open
hez2010 wants to merge 3 commits into
Open
Conversation
Contributor
Author
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates gtSplitTree to better annotate compiler-generated temps created during tree splitting, including marking them as single-definition locals and propagating reference type class metadata when available.
Changes:
- Marks the temporary local produced by
gtNewTempStoreaslvSingleDef. - When the value is a
TYP_REF, attempts to propagate its class handle to the temp vialvaSetClass. - Refactors the splitting logic to use a named
valuetemp for clarity.
Comments suppressed due to low confidence (2)
src/coreclr/jit/gentree.cpp:1
isNonNullis computed viagtGetClassHandle(...)but not used. Either removeisNonNullentirely if it’s not needed here, or (preferred if available in this codebase) propagate the non-null information to the temp local (e.g., via the appropriate lva* API) so the extra work has a functional effect.
src/coreclr/jit/gentree.cpp:1- This directly mutates
lvSingleDefat the point of inserting a store. If later phases can introduce additional defs for this temp (or iflvSingleDefis expected to be derived by an analysis pass instead of being set manually), this risks stale/incorrect single-def metadata. Consider setting this only when the temp is created (where its lifetime/def-count is guaranteed), or using an existing helper/annotation mechanism for ‘compiler temp known single-def’ (so invariants stay centralized).
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
src/coreclr/jit/gentree.cpp:1
isNonNullis populated bygtGetClassHandlebut never used afterward. If nullability isn’t needed here, passnullptrfor that out-param and removeisNonNull; if it is needed, propagate it onto the local using the appropriate local/property so the information isn’t computed and then dropped.
src/coreclr/jit/gentree.cpp:1- Prefer assigning boolean fields using
true/falserather than1/0to better communicate intent and avoid relying on the underlying representation of the field.
AndyAyersMS
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Propagate the class handle when we spill a tree into a local so that later devirtualization can see the more exact class.
Codegen for the snippet in the linked issue:
Before:
After:
Resolves #128483