https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127693
--- Comment #20 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:b4de9d73b47972bc89df288997c8f3a3862bc1b1 commit r17-4887-gb4de9d73b47972bc89df288997c8f3a3862bc1b1 Author: Richard Biener <[email protected]> Date: Mon Oct 5 10:07:06 2026 +0200 tree-optimization/127693 - missed FRE in loop #3 When walk_non_aliased_vuses translated the reference it made get_continuation_for_phi fail when reaching a region already recorded in the visited bitmap. This was to avoid trusting regions that were skipped when walking with the original reference (PR54498). But this also causes failure when two PHI argument paths merge before reaching the dominating definition since the second walk then runs into the region recorded by the first walk with the same reference. Instead of aborting, clear the visited bitmap when the reference is translated. This ensures all regions recorded in it were verified with the current reference and makes the abort_on_visited flag unnecessary. This is simpler and cheaper than attempting to set up secondary visited sets esp. since translations are uncommon. For those we now eventually visit ops multiple times though (counted against the walking budget). It's worth keeping patch #2 to avoid redundant walks. PR tree-optimization/127693 * tree-ssa-alias.h (get_continuation_for_phi): Remove abort_on_visited argument. * tree-ssa-alias.cc (maybe_skip_until): Likewise. Always succeed when reaching an already visited region. (get_continuation_for_phi): Remove abort_on_visited argument. (walk_non_aliased_vuses): Clear the visited bitmap when translating the reference instead of tracking whether we translated. * ipa-prop.cc (determine_known_aggregate_parts): Adjust. * tree-ssa-pre.cc (translate_vuse_through_block): Likewise. * gcc.dg/tree-ssa/ssa-fre-118.c: New testcase.
