-
- Downloads
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.
Showing
- gcc/rtl-ssa/accesses.cc 50 additions, 2 deletionsgcc/rtl-ssa/accesses.cc
- gcc/rtl-ssa/accesses.h 18 additions, 4 deletionsgcc/rtl-ssa/accesses.h
- gcc/rtl-ssa/member-fns.inl 6 additions, 6 deletionsgcc/rtl-ssa/member-fns.inl
- gcc/rtl-ssa/movement.h 3 additions, 3 deletionsgcc/rtl-ssa/movement.h
- gcc/testsuite/g++.dg/pr104869.C 78 additions, 0 deletionsgcc/testsuite/g++.dg/pr104869.C
Loading
Please register or sign in to comment