gpu_group_references: check for overlapping writes again after merge
gpu_group_references calls group_writes (twice) for merging
reference groups that overlap, where two groups are considered
to overlap if they access the same elements and if at least one
of the two involves a write. However, the merged reference group
replaces one of the two groups and is only compared against groups
that this original group has not been compared against yet.
If, say, a read is first compared against another read and then
against a write, then it is combined with the write, but not with
the read, while this second read may very well overlap with the write,
resulting in incorrect code.
To avoid this problem, check for overlaps again as soon as
any other group was merged into the current group.
It is tricky to construct a test case that would fail without this fix
because the writes usually appear first in the list of references.
Reads can be moved ahead of writes to fill a hole left when merging
two other groups, but if this happens inside group_overlapping_writes,
then the read will likely still get merged in inside
group_depth_overlapping_writes.
Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>