https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127693
--- Comment #19 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:3a4787033e4b5dea2d1f7a6b30d4c85a00b7b91d commit r17-4886-g3a4787033e4b5dea2d1f7a6b30d4c85a00b7b91d Author: Richard Biener <[email protected]> Date: Mon Oct 5 08:50:07 2026 +0200 tree-optimization/127693 - missed FRE in loop #2 This is another aspect of the PR127693 showed missed FRE in loops when there was a ref translation. When get_continuation_for_phi is entered with abort_on_visited true because we're in the process of walking a backedge with a translated ref it is important to not call maybe_skip_until for the same virtual operand multiple times as that will surely trip abort_on_visited. But that safety is for detecting whether we already visited the place prior to get_continuation_for_phi. The fix is to avoid doing duplicate work (which is good in any case). Use a sorted vector of PHI arguments for this. PR tree-optimization/127693 * tree-ssa-alias.cc (cmp_intpair): New qsort helper. (get_continuation_for_phi): Sort the PHI args and avoid processing duplicates. * gcc.dg/tree-ssa/ssa-fre-117.c: New testcase.
