https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108582
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>: https://gcc.gnu.org/g:876b3e0514bc8cb2256c44db56255403bedfa52d commit r13-5493-g876b3e0514bc8cb2256c44db56255403bedfa52d 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. Ok? Bootstrapped and tested on x86_64-linux-gnu with no regressions? 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.