https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111583
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:962ca7149d652e4077a2259886e5cd2ea3cea0ab commit r14-4329-g962ca7149d652e4077a2259886e5cd2ea3cea0ab Author: Richard Biener <rguent...@suse.de> Date: Fri Sep 29 11:08:18 2023 +0200 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.