https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80738
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |WAITING Last reconfirmed| |2019-06-18 Ever confirmed|0 |1 --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- Btw, what's a C++ testcase for this? With a simple #include <utility> int f(int i, int j) { std::swap(i, j); return i; } I don't see this pattern. If it only happens with more complex types the fact that we may end up with aggregate copies or multiple loads/stores will break the simplistic pattern detection.