https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101088
--- 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:43fc4234ad3d9302d3460385b6fdb5e3f59b6986 commit r12-1526-g43fc4234ad3d9302d3460385b6fdb5e3f59b6986 Author: Richard Biener <rguent...@suse.de> Date: Wed Jun 16 09:49:18 2021 +0200 tree-optimization/101088 - fix SM invalidation issue When we face a sm_ord vs sm_unord for the same ref during store sequence merging we assert that the ref is already marked unsupported. But it can be that it will only be marked so during the ongoing merging so instead of asserting mark it here. Also apply some optimization to not waste resources to search for already unsupported refs. 2021-06-16 Richard Biener <rguent...@suse.de> PR tree-optimization/101088 * tree-ssa-loop-im.c (sm_seq_valid_bb): Only look for supported refs on edges. Do not assert same ref but different kind stores are unsuported but mark them so. (hoist_memory_references): Only look for supported refs on exits. * gcc.dg/torture/pr101088.c: New testcase.