yaxunl added a comment.

In D101389#2724636 <https://reviews.llvm.org/D101389#2724636>, @rjmccall wrote:

> I think this is intentional; requiring the indirect-result parameter to be in 
> the alloca address space would prevent direct initialization of non-temporary 
> memory, which is an important optimization in C++.

You mean situations like this? https://godbolt.org/z/KnPs6znK8

Address of a global variable is directly passed as the sret arg to the function 
returning a struct, instead of creating a temporary struct variable and passing 
its address as the sret arg?

However, this is forbidden in CUDA/HIP: https://godbolt.org/z/1hjsrn9Tn

So can we assume sret arg is always in alloca addr space for CUDA/HIP?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101389/new/

https://reviews.llvm.org/D101389

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to