]> git.ipfire.org Git - thirdparty/gcc.git/commit
rtl-ssa: Fix split_clobber_group tree insertion [PR116044]
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 25 Jul 2024 07:54:22 +0000 (08:54 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Thu, 25 Jul 2024 07:54:22 +0000 (08:54 +0100)
commit72fbd3b2b2a497dbbe6599239bd61c5624203ed0
tree3afc11bcb2ae9c2f87dfdf0029c97e67ee79face
parent3adfcc5802237e1299d67e6d716481cd3db2234a
rtl-ssa: Fix split_clobber_group tree insertion [PR116044]

PR116044 is a regression in the testsuite on AMD GCN caused (again)
by the split_clobber_group code.  The first patch in this area
(g:71b31690a7c52413496e91bcc5ee4c68af2f366f) fixed a bug caused
by carrying the old group over as one of the split ones.  That
patch instead:

- created two new groups
- inserted them in the splay tree as neighbours of the old group
- removed the old group, and
- invalidated the old group (to force lazy recomputation when
  a clobber's parent group is queried)

However, this left add_def trying to insert the new definition
relative to a stale splay tree root.  The second patch
(g:34f33ea801563e2eabb348e8d3e9344a91abfd48) attempted to fix
that by inserting it relative to the new root.  But that's not
always correct either.  We specifically want to insert it after
the first of the two new groups, whether that group is the root
or not.

This patch does that, and tries to refactor the code to make
it a bit less brittle.

gcc/
PR rtl-optimization/116044
* rtl-ssa/functions.h (function_info::split_clobber_group): Return
an array of two clobber_groups.
* rtl-ssa/accesses.cc (function_info::split_clobber_group): Return
the new clobber groups.  Don't modify the splay tree here.
(function_info::add_def): Update call accordingly.  Generalize
the splay tree insertion code so that the new definition can be
inserted as a child of any existing node, not just the root.
Fix the insertion used after calling split_clobber_group.
gcc/rtl-ssa/accesses.cc
gcc/rtl-ssa/functions.h