https://gcc.gnu.org/bugzilla/show_bug.cgi?id=22237

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Just an FYI, LLVM uses memmove here instead of 2 memcpy.  

If we care about how memcpy we do, we can extend
https://gcc.gnu.org/pipermail/gcc-patches/2025-May/684017.html to do the
memmove for:
```
+  /* For 2 memory refences and using a temporary to do the copy,
+     don't remove the temporary as the 2 memory references might overlap.
+     Note t does not need to be decl as it could be field.
+     See PR 22237 for full details.
+     E.g.
+     t = *a;
+     *b = t;
+     Cannot be convert into
+     t = *a;
+     *b = *a;
+  */
+  if (!DECL_P (dest) && !DECL_P (src2))
+    return false;

```

I am putting this into the bug report to remind me later on if we care enough.
this will have to be for the late forwprop but we should be able to handle the
conversion easily.

Reply via email to