ir3/ra: Fix array parallelcopy confusion
authorConnor Abbott <cwabbott0@gmail.com>
Wed, 16 Jun 2021 13:55:30 +0000 (15:55 +0200)
committerMarge Bot <eric+marge@anholt.net>
Wed, 16 Jun 2021 22:45:13 +0000 (22:45 +0000)
commite19f1124353bf0c76072d8687bb93b78fd2970cf
treee4e8c673a464426edaf36c6dca8df1ab5afeab39
parent2c21dab36e55eaa3f6b083bc5c3bc0573321fdb5
ir3/ra: Fix array parallelcopy confusion

With array registers, there are two num's we care about:

1. The base num that the whole array starts at (->array.base)
2. The num that the instruction uses, plus possibly an indirect offset
   (->num or ->array.offset)

For parallel copies we always copy the whole array, so (2) is irrelevant
here. For phis and parallel copies inserted for phis, we used
assign_reg() which assigned ->array.base, but we forgot about this when
constructing our own parallel copies for live range splitting, just
setting ->num instead. The parallel copy lowering was also inconsistent
here, using ra_reg_get_num() (which looks at ->array.base for arrays)
for sources but looking at ->num directly for destinations. This makes
everything use ->array.base consistently.

While we're here, make sure to remove IR3_REG_SSA from liveout copies to
make sure printing works correctly.

Fixes: 0ffcb19 ("ir3: Rewrite register allocation")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11422>
src/freedreno/ir3/ir3_lower_parallelcopy.c
src/freedreno/ir3/ir3_ra.c