https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102436
--- Comment #3 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:0fc859f5efcb4624a8b4ffdbf34d63972af179a8 commit r12-5394-g0fc859f5efcb4624a8b4ffdbf34d63972af179a8 Author: Richard Biener <rguent...@suse.de> Date: Thu Nov 18 13:40:32 2021 +0100 tree-optimization/102436 - restore loop store motion This restores a case of conditional store motion we fail to handle after the rewrite. We can recognize the special case of all stores in a loop happening in a single conditionally executed block which ensures stores are not re-ordered by executing them in different loop iterations. Separating out the case avoids complicating the already complex main path. 2021-11-18 Richard Biener <rguent...@suse.de> PR tree-optimization/102436 * tree-ssa-loop-im.c (execute_sm_if_changed): Add mode to just create the if structure and return the then block. (execute_sm): Add flag to indicate the var will re-use another flag var. (hoist_memory_references): Support a single conditional block with all stores as special case. * gcc.dg/torture/20211118-1.c: New testcase. * gcc.dg/tree-ssa/ssa-lim-18.c: Likewise.