https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129064
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <[email protected]>: https://gcc.gnu.org/g:9a872903b6f73840a5128790e9127e063173adb0 commit r17-6735-g9a872903b6f73840a5128790e9127e063173adb0 Author: Richard Biener <[email protected]> Date: Thu Nov 26 14:45:45 2026 +0100 tree-optimization/129064 - do not commit PHI values when checking backedges When checking whether values changed over a backedge, do_rpo_vn visits the destination PHIs and keeps the new value of the first PHI that changed. When we then iterate and re-visit the destination block, PHIs before that one already see its new value while others still see values from the previous iteration. That lets one PHI cycle advance a step ahead of an equivalent one. The two cycles then look different, the lagging one goes VARYING, and since VARYING is final we never discover that they are equivalent. Restore the previous value after the check so the re-visit evaluates all PHIs consistently. PR tree-optimization/129064 * tree-ssa-sccvn.cc (do_rpo_vn_1): Restore the previous value of a backedge destination PHI after detecting a change. * gcc.dg/tree-ssa/ssa-fre-119.c: New testcase.
