-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Incorrect handling of pointer to return value in ARM64EC entry thunks #90229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Comments
@llvm/issue-subscribers-backend-aarch64 Author: Alexandre Julliard (julliard)
When a function returns a structure that doesn't fit in a register, a pointer to the storage for the return value is passed as hidden parameter. On x86-64 this takes the place of the first parameter (%rcx) but on aarch64 this uses the x8 register.
This means that ARM64EC entry thunks need to shuffle registers to move x0 -> x8, x1 -> x0, etc. Here's a test case:
The corresponding entry thunk generated by LLVM doesn't convert anything:
While MSVC generates code to shuffle registers:
|
efriedma-quic
added a commit
to efriedma-quic/llvm-project
that referenced
this issue
May 15, 2024
I accidentally left out the code to transfer sret attributes to entry thunks, so values weren't being passed in the right registers, and the sret pointer wasn't returned in the correct register. Fixes llvm#90229
efriedma-quic
added a commit
that referenced
this issue
May 16, 2024
I accidentally left out the code to transfer sret attributes to entry thunks, so values weren't being passed in the right registers, and the sret pointer wasn't returned in the correct register. Fixes #90229
I can confirm that this fixed the problem I was seeing. Thanks! |
dpaoliello
pushed a commit
to dpaoliello/llvm-project
that referenced
this issue
May 17, 2024
I accidentally left out the code to transfer sret attributes to entry thunks, so values weren't being passed in the right registers, and the sret pointer wasn't returned in the correct register. Fixes llvm#90229
tstellar
pushed a commit
to dpaoliello/llvm-project
that referenced
this issue
May 17, 2024
I accidentally left out the code to transfer sret attributes to entry thunks, so values weren't being passed in the right registers, and the sret pointer wasn't returned in the correct register. Fixes llvm#90229
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When a function returns a structure that doesn't fit in a register, a pointer to the storage for the return value is passed as hidden parameter. On x86-64 this takes the place of the first parameter (%rcx) but on aarch64 this uses the x8 register.
This means that ARM64EC entry thunks need to shuffle registers to move x0 -> x8, x1 -> x0, etc. Here's a test case:
The corresponding entry thunk generated by LLVM doesn't convert anything:
While MSVC generates code to shuffle registers:
The text was updated successfully, but these errors were encountered: