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.