[PATCH] D101389: [clang][CodeGen] Fix address space for sret
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 28 22:17:23 PDT 2021
rjmccall added a comment.
In D101389#2724700 <https://reviews.llvm.org/D101389#2724700>, @yaxunl wrote:
> 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?
That's one specific case of copy-elision, but there are others, e.g.: https://godbolt.org/z/boTeMseaM
I suppose you could disable general copy-elision. But don't you have aggressive optimizations to strength-reduce generic pointer operations?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D101389/new/
https://reviews.llvm.org/D101389
More information about the cfe-commits
mailing list