[RyuJIT] Make the mis-sized struct return logic only apply to return values that are structs#126772
Open
kg wants to merge 5 commits intodotnet:mainfrom
Open
[RyuJIT] Make the mis-sized struct return logic only apply to return values that are structs#126772kg wants to merge 5 commits intodotnet:mainfrom
kg wants to merge 5 commits intodotnet:mainfrom
Conversation
Contributor
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a RyuJIT lowering assertion encountered in WASM codegen when a struct return’s value node has an erased (non-struct) type, which caused an invalid spill-to-struct-temp transformation.
Changes:
- Guard the mis-sized struct return “spill to temp local” workaround so it only runs when the return value node is actually
TYP_STRUCT. - Avoid invoking
ReplaceWithLclVarto store a non-struct-typedGT_INDinto a struct-typed temp local.
Member
Author
|
I misread something and this is incorrect. Will keep working on it. |
5ffc15f to
42e0205
Compare
Member
Author
|
@dotnet/jit-contrib PTAL |
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.
This addresses an assert in wasm codegen with a release SPC, i.e.:
Would produce:
The problem is that we are creating a temporary local of struct type using the
retTypeClass, but the type of the return value was erased, so we try to turn aGT_INDof typeTYP_UBYTEinto a temp ofTYP_STRUCTwhich can't possibly work the wayReplaceWithLclVaris constructed.EDIT:
In this scenario what we need to do is zero-extend the mis-sized return value (a byte or short, most likely) to match the native return type's size. So I wrap the return value in a CAST.