https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126103
--- Comment #16 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Aldy Hernandez <[email protected]>: https://gcc.gnu.org/g:3e43b55eb8fb520b6ed161697249fcef6699d11b commit r17-3265-g3e43b55eb8fb520b6ed161697249fcef6699d11b Author: Aldy Hernandez <[email protected]> Date: Thu Aug 13 10:28:51 2026 +0000 backwards threader: handle SSA names occurring in abnormal PHIs The backward threader refuses to look at any SSA name occurring in an abnormal PHI, but DOM's threader does, at least for PHIs where the path taken does not include an abnormal edge. For example: x_5(ab) = PHI <45(5), y_8(ab)> ... if (x_5 == 45) If we're threading a path coming in from BB5, it's perfectly valid to thread this path, even if x_5 itself is AB. With gimple_range_ssa_p no longer rejecting these names, the path solver handles them as is: a path never includes abnormal edges, so an abnormal PHI still resolves to its argument on the path's incoming edge. Drop the last discovery restriction in the backward threader. Only normal predecessor edges are ever walked, so no abnormal edge is duplicated. This also enables threading computed gotos whose destination occurs in an abnormal PHI, which happens when the goto block is itself one of the goto's targets. Tested on ppc64le Linux. gcc/ChangeLog: PR tree-optimization/126103 * tree-ssa-threadbackward.cc (back_threader::find_paths_to_names): Follow abnormal PHIs. gcc/testsuite/ChangeLog: PR tree-optimization/126103 * gcc.dg/tree-ssa/ssa-thread-abnormal-phi-1.c: New test. * gcc.dg/tree-ssa/ssa-thread-abnormal-phi-2.c: New test. * gcc.dg/tree-ssa/backthread-computed-goto-2.c: New test.
