[clang] [clang][CodeGen] `sret` args should always point to the `alloca` AS, so use that (PR #114062)

Alex Voicu via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 17 18:10:00 PST 2025


AlexVlx wrote:

> > seeing breaks in downstream build of rocPRIM
> 
> Probably need to revert the downstream revert of the original problematic patch

It's not quite that, we have a problem with the following pattern: <https://gcc.godbolt.org/z/4bheaqYev>. `r` is a returned val so it will come from an / as the result of uncasted `alloca`, therefore its address will point to the AllocaAS. C and C++ casts yield bitcasts, not AS casts, so we end up with an C cast expr (see AST) that tries to bitcast from a pointer to the AllocaAS to a pointer to flat / generic, which is invalid. I'm not entirely yet sure how to fix this yet except going to an earlier iteration of this where we use casted `alloca`s everywhere and handle `sret` a bit more noisily.

https://github.com/llvm/llvm-project/pull/114062


More information about the cfe-commits mailing list