https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103856
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Alexandre Oliva <aol...@gcc.gnu.org>: https://gcc.gnu.org/g:e53bb1965db9c7882ded4a70296340d8db52053a commit r12-7381-ge53bb1965db9c7882ded4a70296340d8db52053a Author: Alexandre Oliva <ol...@adacore.com> Date: Thu Feb 24 22:03:32 2022 -0300 Copy EH phi args for throwing hardened compares When we duplicate a throwing compare for hardening, the EH edge from the original compare gets duplicated for the inverted compare, but we failed to adjust any PHI nodes in the EH block. This patch adds the needed adjustment, copying the PHI args from those of the preexisting edge. for gcc/ChangeLog PR tree-optimization/103856 * gimple-harden-conditionals.cc (non_eh_succ_edge): Enable the eh edge to be requested through an extra parameter. (pass_harden_compares::execute): Copy PHI args in the EH dest block for the new EH edge added for the inverted compare. for gcc/testsuite/ChangeLog PR tree-optimization/103856 * g++.dg/pr103856.C: New.