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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Richard Sandiford
<rsand...@gcc.gnu.org>:

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

commit r11-10110-gd6a8ac7e92dfe0a51d71525e212147d0b84f1224
Author: Richard Sandiford <richard.sandif...@arm.com>
Date:   Mon Jul 4 20:02:26 2022 +0100

    rtl-ssa: Fix prev/next_def confusion [PR104869]

    rtl-ssa chains definitions into an RPO list.  It also groups
    sequences of clobbers together into a single node, so that it's
    possible to skip over the clobbers in constant time in order to
    get the next or previous set.

    When adding a clobber to an insn, the main DF barriers for that
    clobber are the last use of the previous set (if any) and the next
    set (if any); adding a new clobber to a sea of clobbers is fine.
    def_lookup provided the basis for these barriers as prev_def ()
    and next_def ().

    But of course, in hindsight, those were bad names, since they
    implied that the returned values were literally the previous
    definition (of any kind) or the next definition (of any kind).
    And function_info::make_use_available was using the same routines
    assuming that they had that meaning. :-(

    This made a difference for the case where the start of a BB
    occurs in the middle of an (RPO) clobber group: we then want
    the previous and next clobbers in the group, rather than the
    set before the clobber group and the set after the clobber group.

    This patch renames the existing routines to something that's hopefully
    clearer (though also more long-winded).  It then adds routines that
    really do provide the previous and next definitions.

    This complication is supposed to be internal to rtl-ssa and, as
    mentioned above, is part of trying to reduce time complexity.

    gcc/
            PR middle-end/104869
            * rtl-ssa/accesses.h (clobber_group::prev_clobber): Declare.
            (clobber_group::next_clobber): Likewise.
            (def_lookup::prev_def): Rename to...
            (def_lookup::last_def_of_prev_group): ...this.
            (def_lookup::next_def): Rename to...
            (def_lookup::first_def_of_next_group): ...this.
            (def_lookup::matching_or_prev_def): Rename to...
            (def_lookup::matching_set_or_last_def_of_prev_group): ...this.
            (def_lookup::matching_or_next_def): Rename to...
            (def_lookup::matching_set_or_first_def_of_next_group): ...this.
            (def_lookup::prev_def): New function, taking the lookup insn as
            argument.
            (def_lookup::next_def): Likewise.
            * rtl-ssa/member-fns.inl (def_lookup::prev_def): Rename to...
            (def_lookup::last_def_of_prev_group): ...this.
            (def_lookup::next_def): Rename to...
            (def_lookup::first_def_of_next_group): ...this.
            (def_lookup::matching_or_prev_def): Rename to...
            (def_lookup::matching_set_or_last_def_of_prev_group): ...this.
            (def_lookup::matching_or_next_def): Rename to...
            (def_lookup::matching_set_or_first_def_of_next_group): ...this.
            * rtl-ssa/movement.h (restrict_movement_for_dead_range): Update
after
            above renaming.
            * rtl-ssa/accesses.cc (clobber_group::prev_clobber): New function.
            (clobber_group::next_clobber): Likewise.
            (def_lookup::prev_def): Likewise.
            (def_lookup::next_def): Likewise.
            (function_info::make_use_available): Pass the lookup insn to
            def_lookup::prev_def and def_lookup::next_def.

    gcc/testsuite/
            PR middle-end/104869
            * g++.dg/pr104869.C: New test.

    (cherry picked from commit 4a3073f04e8b7987ad7bfe1bc23bfeb1d627ee6a)

Reply via email to