llvm-project
90978e48 - [arm64ec] Fix missing sret return in Arm64EC entry thunks for large struct returns (#185452)

Commit
48 days ago
[arm64ec] Fix missing sret return in Arm64EC entry thunks for large struct returns (#185452) When an Arm64EC function returns a struct by value that is too large for x64's `RAX` (>8 bytes), the entry thunk synthesizes a hidden sret pointer parameter for the x64 side. However, this parameter was never marked with the sret attribute, so ISel did not copy its value into `x8` (the Arm64EC mapping of `RAX`) on return. This caused the x64 caller to see a garbage pointer in `RAX` instead of the return buffer address. The change adds the sret attribute to the thunk's synthesized pointer parameter, so that `LowerFormalArguments` saves it and `LowerReturn` restores it to `x8` before the tail call to `__os_arm64x_dispatch_ret`. Fixes #185390
Author
Parents
Loading