tree-optimization/111583 - loop distribution issue
commit962ca7149d652e4077a2259886e5cd2ea3cea0ab
authorRichard Biener <rguenther@suse.de>
Fri, 29 Sep 2023 09:08:18 +0000 (29 11:08 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 29 Sep 2023 09:50:14 +0000 (29 11:50 +0200)
treef169a8095f996064259b51e5a5e4883edf1a329c
parent59cda1f9525702d5d6560002c874f12c0103f7df
tree-optimization/111583 - loop distribution issue

The following conservatively fixes loop distribution to only
recognize memset/memcpy and friends when at least one element
is going to be processed.  This avoids having an unconditional
builtin call in the IL that might imply the source and destination
pointers are non-NULL when originally pointers were not always
dereferenced.

With -Os loop header copying is less likely to ensure this.

PR tree-optimization/111583
* tree-loop-distribution.cc (find_single_drs): Ensure the
load/store are always executed.

* gcc.dg/tree-ssa/pr111583-1.c: New testcase.
* gcc.dg/tree-ssa/pr111583-2.c: Likewise.
gcc/testsuite/gcc.dg/tree-ssa/pr111583-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/pr111583-2.c [new file with mode: 0644]
gcc/tree-loop-distribution.cc