[PATCH] D23937: [MemCpyOpt] Return value `memcpy` elision.
bryant via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 26 16:25:08 PDT 2016
bryant added a comment.
In https://reviews.llvm.org/D23937#526679, @efriedma wrote:
> This isn't safe. Consider:
>
> void f(bool b) {
> S x, y;
> g(&x, &y);
> if (b) {
> return x; // memcpy to sret
> } else {
> return y; // memcpy to sret
> }
> }
>
>
> With your transform, the two arguments to g become the same pointer.
Is this the only case it would be unsafe, i.e., in the general case, it's always safe as long as sret depends on a single alloca. Would that be the correct rule, or perhaps too restrictive?
Repository:
rL LLVM
https://reviews.llvm.org/D23937
More information about the llvm-commits
mailing list