https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106922
--- Comment #30 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:b9f58edfc2ccb0fb3840751a2fb4268ce5dd9b3d commit r12-8837-gb9f58edfc2ccb0fb3840751a2fb4268ce5dd9b3d Author: Richard Biener <rguent...@suse.de> Date: Fri Sep 23 14:28:52 2022 +0200 tree-optimization/106922 - extend same-val clobber FRE The following extends the skipping of same valued stores to handle an arbitrary number of them as long as they are from the same value (which we now record). That's an obvious extension which allows to optimize the m_engaged member of std::optional more reliably. PR tree-optimization/106922 * tree-ssa-sccvn.cc (vn_reference_lookup_3): Allow an arbitrary number of same valued skipped stores. * g++.dg/torture/pr106922.C: New testcase. (cherry picked from commit af611afe5fcc908a6678b5b205fb5af7d64fbcb2)