JIT: Remove redundant normalizing casts when passing and returning structs#118345
Merged
jakobbotsch merged 2 commits intodotnet:mainfrom Aug 5, 2025
Merged
JIT: Remove redundant normalizing casts when passing and returning structs#118345jakobbotsch merged 2 commits intodotnet:mainfrom
jakobbotsch merged 2 commits intodotnet:mainfrom
Conversation
Member
Author
|
/azp run Fuzzlyn |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This change optimizes the JIT by removing redundant normalizing casts when returning promoted structs. It addresses a performance regression introduced by #113178 which forced all returned promoted structs to use FIELD_LIST morphing, leading to unnecessary normalization that didn't exist in the previous LowerRetSingleRegStructLclVar code path.
Key changes:
- Removes
genActualType()call when determining register types for return field lists - Adds optimization logic to eliminate unnecessary casts on the last register entry when returning structs
Member
Author
|
cc @dotnet/jit-contrib PTAL @amanasifkhalid Opened #118377 for the Fuzzlyn issue. Diffs. Pretty minor, but affects the micro benchmark. |
amanasifkhalid
approved these changes
Aug 5, 2025
This was referenced Aug 11, 2025
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
#113178 switched returned promoted structs to always be morphed to
FIELD_LISTand started handling the introducedFIELD_LISTin the backend. However, this change introduced new unnecessary normalization when returning promoted structs that previously would not happen with the oldLowerRetSingleRegStructLclVarcode path.This change adds an optimization to get rid of the introduced normalization when possible.
Fix #113382
For the benchmark: