llvm-project
e2f7f836 - [Clang] Fix invalid sret addrspacecast for placement new on HIP (#183639)

Commit
50 days ago
[Clang] Fix invalid sret addrspacecast for placement new on HIP (#183639) When a HIP kernel uses placement new with a function returning an aggregate via sret (e.g. `new (out) T(make_t())`), and the placement destination is in global memory (addrspace 1), the sret pointer was addrspacecast'd to addrspace 5 (private), producing an invalid pointer that faults at runtime. Instead of casting the caller's pointer directly, materialise a temporary alloca in the callee's expected address space, pass that as the sret argument, and copy the result back to the original destination after the call.
Author
Parents
Loading