https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99728
--- Comment #15 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:9f34b780b0461ec7b2b2defe96e44ab616ea2aa3 commit r12-2097-g9f34b780b0461ec7b2b2defe96e44ab616ea2aa3 Author: Richard Biener <rguent...@suse.de> Date: Wed Jul 7 11:41:03 2021 +0200 tree-optimization/99728 - improve LIM for loops with aggregate copies This improves LIM by recording aggregate copies for disambiguation purposes instead of as UNANALYZABLE_MEM which will prevent any invariant or store motion across it. This allows four of the six references in the loop of the testcase to be promoted. 2021-07-07 Richard Biener <rguent...@suse.de> PR tree-optimization/99728 * tree-ssa-loop-im.c (gather_mem_refs_stmt): Record aggregate copies. (mem_refs_may_alias_p): Add assert we handled aggregate copies elsewhere. (sm_seq_valid_bb): Give up when running into aggregate copies. (ref_indep_loop_p): Handle aggregate copies as never being invariant themselves but allow other refs to be disambiguated against them. (can_sm_ref_p): Do not try to apply store-motion to aggregate copies. * g++.dg/opt/pr99728.C: New testcase.