https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103596
--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-11 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:08f594465fa9b6a4ea1e3816cfecf256e883ff53 commit r11-9524-g08f594465fa9b6a4ea1e3816cfecf256e883ff53 Author: Richard Biener <rguent...@suse.de> Date: Tue Dec 7 11:13:39 2021 +0100 tree-optimization/103596 - fix missed propagation into switches may_propagate_copy unnecessarily restricts propagating non-abnormals into places that currently contain an abnormal SSA name but are not the PHI argument for an abnormal edge. This causes VN to not elide a CFG path that it assumes is elided, resulting in released SSA names in the IL. The fix is to enhance the may_propagate_copy API to specify the destination is _not_ a PHI argument. I chose to not update only the relevant caller in VN and the may_propagate_copy_into_stmt API at this point because this is a regression and needs backporting. 2021-12-07 Richard Biener <rguent...@suse.de> PR tree-optimization/103596 * tree-ssa-sccvn.c (eliminate_dom_walker::eliminate_stmt): Note we are not propagating into a PHI argument to may_propagate_copy. * tree-ssa-propagate.h (may_propagate_copy): Add argument specifying whether we propagate into a PHI arg. * tree-ssa-propagate.c (may_propagate_copy): Likewise. When not doing so we can replace an abnormal with something else. (may_propagate_into_stmt): Update may_propagate_copy calls. (replace_exp_1): Move propagation checking code to propagate_value and rename to ... (replace_exp): ... this and elide previous wrapper. (propagate_value): Perform checking with adjusted may_propagate_copy call and dispatch to replace_exp. * gcc.dg/torture/pr103596.c: New testcase. (cherry picked from commit 6e8a31275fda445fb3e8d98e53f5e1541f4727af)