gpu.c: group_array_references: maintain proper groups during construction
gpu.c: group_array_references: maintain proper groups during construction

The original code would only construct the refs array at the very end of
group_array_references.  We now maintain a proper refs array from the start.
This simplifies the logic and makes it easier to perform further merging
of groups.

Signed-off-by: Sven Verdoolaege <e5350bbed4977f5eb8ae1dc6abd9ae59d21ace75@kotnet.org>

Meinersbur/ppcg,nicolasvasilache/ppcg,nicolasvasilache/ppcg,Meinersbur/ppcg