https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121757
--- Comment #16 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-15 branch has been updated by Richard Sandiford <[email protected]>: https://gcc.gnu.org/g:34bc617b34b62f59dc53ad0de165accb603cb08a commit r15-10316-g34bc617b34b62f59dc53ad0de165accb603cb08a Author: Richard Sandiford <[email protected]> Date: Thu Sep 11 17:32:38 2025 +0100 rtl-ssa: Maintain clobber_group invariant [PR121757] In order to reduce time complexity, rtl-ssa groups consecutive clobbers together. Each group of clobbers has a splay tree for lookup and manipulation purposes. This arrangement means that we might need to split a group (when inserting a new non-clobber definition between two clobbers) or to join consecutive groups together (when deleting an intervening non-clobber definition). To reduce the time complexity of these updates, the back pointer from a clobber to its group is only updated lazily. The invariant is supposed to be that the first clobber, last clobber, and splay tree root have the right group at all times, whereas other members of the group can have identifiably stale group pointers. However, a lack of abstraction meant that only some splay tree lookups correctly maintained this invariant. Others did not update the group pointer after installing a new root. This patch adds a helper that maintains the invariant and uses it in three places, one that was already correct and two that were wrong. The original lookup_clobber is still used in other code that manipulates groups as a whole. gcc/ PR rtl-optimization/121757 * rtl-ssa/accesses.h (clobber_group::lookup_clobber): New member function. * rtl-ssa/accesses.cc (clobber_group::lookup_clobber): Likewise. (clobber_group::prev_clobber, clobber_group::next_clobber) (function_info::add_clobber): Use it. gcc/testsuite/ PR rtl-optimization/121757 * g++.dg/pr121757.C: New test.
