[Bug tree-optimization/99954] [8/9/10/11 Regression] Copy loop over array of unions at -O3 generates memcpy instead of memmove, resulting in incorrect code

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 7 09:49:12 GMT 2021


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-04-07
      Known to work|                            |6.5.0
            Summary|Copy loop over array of     |[8/9/10/11 Regression] Copy
                   |unions at -O3 generates     |loop over array of unions
                   |memcpy instead of memmove,  |at -O3 generates memcpy
                   |resulting in incorrect code |instead of memmove,
                   |                            |resulting in incorrect code
      Known to fail|                            |10.2.0, 11.0, 7.5.0, 8.4.0,
                   |                            |9.3.0
                 CC|                            |rguenther at suse dot de
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Sergey Zakharchenko from comment #0)
> As checked on godbolt.org, issue applies to GCC 7+ (6 and below correctly
> generate memmove);

Started with r242470

re PR tree-optimization/78348 ([7 REGRESSION] 15% performance drop for
coremark-pro/nnet-test after r242038)

2016-11-16  Richard Biener

        PR tree-optimization/78348
        * tree-loop-distribution.c (enum partition_kind): Add PKIND_MEMMOVE.
        (generate_memcpy_builtin): Honor PKIND_MEMCPY on the partition.
        (classify_partition): Set PKIND_MEMCPY if dependence analysis
        revealed no dependency, PKIND_MEMMOVE otherwise.

        * gcc.dg/tree-ssa/ldist-24.c: New testcase.


More information about the Gcc-bugs mailing list