https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126906
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Aldy Hernandez <[email protected]>: https://gcc.gnu.org/g:54c3d316d50895d5a81290f9392e5c01b9000519 commit r17-3797-g54c3d316d50895d5a81290f9392e5c01b9000519 Author: Aldy Hernandez <[email protected]> Date: Wed Aug 26 14:56:08 2026 +0000 Add a prevailing exit edge to copy_bbs [PR126906] Teach the generic copier that one edge out of the region prevails, so the backwards threader can handle abnormal edges out of a path. Tested on ppc64le Linux. PR tree-optimization/126906 gcc/ChangeLog: * cfghooks.h (can_copy_bbs_p): Add prevailing_exit argument. (copy_bbs): Likewise. * cfghooks.cc (can_copy_bbs_p): Exempt prevailing_exit->src from the abnormal successor edge refusal; refuse a prevailing_exit->dest inside the region. (copy_bbs): Prune the non-prevailing edges of prevailing_exit->src's copy instead of redirecting them. Assert the prevailing exit leaves the region. * tree-ssa-threadupdate.cc (back_jt_path_registry::duplicate_thread_path): Pass EXIT to can_copy_bbs_p and copy_bbs when the path ends in abnormal edges. Assert the region ends in EXIT's source. Remove write-only exit_copy. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/ssa-thread-25.c: New test. * gcc.dg/tree-ssa/ssa-thread-26.c: New test.
