https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127693
--- Comment #14 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:2ae9740dde8225371d3791a71b99d52ef686e2cc commit r17-4840-g2ae9740dde8225371d3791a71b99d52ef686e2cc Author: Richard Biener <[email protected]> Date: Fri Oct 2 16:04:15 2026 +0200 tree-optimization/127693 - missed FRE in loop The following addresses a missed optimization caused by the PR54498 correctness fix. For CFG cycles when get_continuation_for_phi is invoked on a loop PHI with a backedge and abort_on_visited true because we have translated the reference maybe_skip_until will fail because we will definitely hit that PHI again. But the intent was to catch re-visiting actual statements which we will do eventually by visiting the other PHI edges from the caller. So finish the walk at the original PHI latest. This allows the constant 1 to be propagated to the __builtin_constant_p and the bug avoided. PR tree-optimization/127693 * tree-ssa-alias.cc (maybe_skip_until): Stop when reaching the PHI again. * gcc.dg/tree-ssa/ssa-fre-116.c: New testcase.
