[Bug middle-end/32667] block copy with exact overlap is expanded as memcpy

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Nov 22 15:06:02 GMT 2023


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

--- Comment #27 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Rich Felker from comment #26)
> > The only reasonable fix on the compiler side is to never emit memcpy but always use memmove.
> 
> No, it can literally just emit (equivalent at whatever intermediate form of):
> 
> cmp src,dst
> je 1f
> call memcpy
> 1:
> 
> in place of memcpy.

No, that is not a reasonable fix, because it severely pessimizes common code
for a theoretical only problem.


More information about the Gcc-bugs mailing list