[Bug tree-optimization/99954] [8/9 Regression] Copy loop over array of unions at -O3 generates memcpy instead of memmove, resulting in incorrect code
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Apr 28 10:36:00 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99954
--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:b091cb1efa1881e93fb2e264daaab8876acf6800
commit r9-9471-gb091cb1efa1881e93fb2e264daaab8876acf6800
Author: Richard Biener <rguenther@suse.de>
Date: Wed Apr 7 13:17:05 2021 +0200
tree-optimization/99954 - fix loop distribution memcpy classification
This fixes bogus classification of a copy as memcpy. We cannot use
plain dependence analysis to decide between memcpy and memmove when
it computes no dependence. Instead we have to try harder later which
the patch does for the gcc.dg/tree-ssa/ldist-24.c testcase by resorting
to tree-affine to compute the difference between src and dest and
compare against the copy size.
2021-04-07 Richard Biener <rguenther@suse.de>
PR tree-optimization/99954
* tree-loop-distribution.c: Include tree-affine.h.
(generate_memcpy_builtin): Try using tree-affine to prove
non-overlap.
(loop_distribution::classify_builtin_ldst): Always classify
as PKIND_MEMMOVE.
* gcc.dg/torture/pr99954.c: New testcase.
More information about the Gcc-bugs
mailing list