https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122969
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tamar Christina <[email protected]>: https://gcc.gnu.org/g:9d775818e30e73c28ef5743ca8b6ed4ae8ef1383 commit r16-5866-g9d775818e30e73c28ef5743ca8b6ed4ae8ef1383 Author: Tamar Christina <[email protected]> Date: Wed Dec 3 14:10:36 2025 +0000 vect: fix ICE when duplicate dummy IV PHIs are still in CFG [PR122969] All the no-options result in duplicate PHI nodes that use the same values just have different RHS >>> p debug (loop->header) <bb 21> [local count: 958878292]: # a.2_29 = PHI <0(18), _34(25)> # a_lsm.8_31 = PHI <0(18), _34(25)> _34 = a.2_29 + -1; if (_34 != 1) goto <bb 25>; [94.50%] else goto <bb 32>; [5.50%] $11 = void >>> p debug (update_bb) <bb 33> [local count: 958878292]: # a.2_6 = PHI <a_lsm.8_36(32), _41(34)> # a_lsm.8_18 = PHI <a_lsm.8_36(32), _41(34)> _41 = a.2_6 + -1; if (_41 != 1) goto <bb 34>; [94.50%] else goto <bb 26>; [5.50%] $12 = void So one of the PHIs is completely useless. But that makes the update loop visit the PHI twice, but the first time we already updated them so we end up with a non-SSA_NAME there. In the old code we'd just re-update the PHI with the same statement. So I've put back that code as fallback. I'm almost 100% sure you can't get here with any divergent PHI as an inviant has to be a variable before we rewrite it. But as I'm not 100% sure I've put the update fallback instead of skipping the update. gcc/ChangeLog: PR tree-optimization/122969 * tree-vect-loop-manip.cc (vect_update_ivs_after_vectorizer): handle non-ssa name IV var args. gcc/testsuite/ChangeLog: PR tree-optimization/122969 * gcc.dg/vect/pr122969.c: New test.
