https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108582
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-12 branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>: https://gcc.gnu.org/g:6f23c9077feebb29c2a28ffe89b287286df27d6d commit r12-9114-g6f23c9077feebb29c2a28ffe89b287286df27d6d Author: Andrew Pinski <apin...@marvell.com> Date: Sat Jan 28 18:27:08 2023 +0000 Fix PR 108582: ICE due to PHI-OPT removing a still in use ssa_name. This patch adds a check in match_simplify_replacement to make sure the middlebb does not have any phi-nodes as we don't currently move those. This was just a thinko from before. Committed on the GCC 12 branch after a bootstrap/test on x86_64-linux-gnu. PR tree-optimization/108582 gcc/ChangeLog: * tree-ssa-phiopt.cc (match_simplify_replacement): Add check for middlebb to have no phi nodes. gcc/testsuite/ChangeLog: * gcc.dg/pr108582-1.c: New test. (cherry picked from commit 876b3e0514bc8cb2256c44db56255403bedfa52d)