https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96539
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:299c98578bda88c020a6d5b2c319c9e191a315d4 commit r11-2647-g299c98578bda88c020a6d5b2c319c9e191a315d4 Author: Jakub Jelinek <ja...@redhat.com> Date: Tue Aug 11 13:47:29 2020 +0200 expr: Optimize noop copies [PR96539] At GIMPLE e.g. for __builtin_memmove we optimize away (to just the return value) noop copies where src == dest, but at the RTL we don't, and as the testcase shows, in some cases such copies can appear only at the RTL level e.g. from trying to copy an aggregate by value argument to the same location as it already has. If the block move is expanded e.g. piecewise, we actually manage to optimize it away, as the individual memory copies are seen as noop moves, but if the target optabs are used, often the sequences stay until final. 2020-08-11 Jakub Jelinek <ja...@redhat.com> PR rtl-optimization/96539 * expr.c (emit_block_move_hints): Don't copy anything if x and y are the same and neither is MEM_VOLATILE_P. * gcc.target/i386/pr96539.c: New test.