https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123298

--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Richard Biener
<[email protected]>:

https://gcc.gnu.org/g:d389c687fb0aba9f6d3933c004035d589aba1415

commit r15-10971-gd389c687fb0aba9f6d3933c004035d589aba1415
Author: Richard Biener <[email protected]>
Date:   Thu Jan 8 10:10:25 2026 +0100

    tree-optimization/123298 - fix backedge detection for VN alias walk

    When trying to skip a virtual PHI during an alias walk we have to
    direct a possible VN translation hook to not use valueization when
    walking a backedge.  But this backedge detection was overly
    optimistic, not honoring irreducible regions.  The following hookizes
    the backedge detection so VN can properly flag edges that are back
    with respect to its particular CFG traversal.

            PR tree-optimization/123298
            * tree-ssa-alias.h (get_continuation_for_phi): Take a gphi *,
            add is_backedge hook argument.
            (walk_non_aliased_vuses): Add is_backedge hook argument.
            * tree-ssa-alias.cc (maybe_skip_until): Adjust.
            (get_continuation_for_phi): Use new hook to classify an
            edge into the PHI as backedge.
            (walk_non_aliased_vuses): Adjust.
            * gimple-lower-bitint.cc (bitint_dom_walker::before_dom_children):
            Likewise.
            * ipa-prop.cc (determine_known_aggregate_parts): Likewise.
            * tree-ssa-scopedtables.cc (avail_exprs_stack::lookup_avail_expr):
            Likewise.
            * tree-ssa-pre.cc (translate_vuse_through_block): Likewise.
            * tree-ssa-sccvn.cc (vn_bb_to_rpo): Make BB to RPO order
            mapping accessible from new hook.
            (do_rpo_vn_1): Likewise.
            (vn_is_backedge): New hook to classify edge.
            (vn_reference_lookup_pieces): Adjust.
            (vn_reference_lookup): Likewise.

            * gcc.dg/torture/pr123298.c: New testcase.

    (cherry picked from commit 7a8c00dea5ec301d9e5af5fee5ff1fa469ccb1a1)

Reply via email to