[PATCH] D23937: [MemCpyOpt] Return value `memcpy` elision.

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 12:50:40 PDT 2016


efriedma added a subscriber: efriedma.
efriedma added a comment.

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.


Repository:
  rL LLVM

https://reviews.llvm.org/D23937





More information about the llvm-commits mailing list