https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106519
--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tamar Christina <tnfch...@gcc.gnu.org>: https://gcc.gnu.org/g:c832ec4c3ec4853ad89ff3b0dbf6e9454e75e8cc commit r13-1963-gc832ec4c3ec4853ad89ff3b0dbf6e9454e75e8cc Author: Tamar Christina <tamar.christ...@arm.com> Date: Thu Aug 4 16:35:31 2022 +0100 middle-end: Fix phi-ssa assertion triggers. [PR106519] For the diamond PHI form in tree_ssa_phiopt_worker we need to extract edge e2 sooner. This changes it so we extract it at the same time we determine we have a diamond shape. gcc/ChangeLog: PR middle-end/106519 * tree-ssa-phiopt.cc (tree_ssa_phiopt_worker): Check final phi edge for diamond shapes. gcc/testsuite/ChangeLog: PR middle-end/106519 * gcc.dg/pr106519.c: New test.