path: root/src
diff options
authorConnor Abbott <>2021-06-21 14:50:07 +0200
committerMarge Bot <>2021-06-23 17:20:29 +0000
commit078030973bfe8164b529f77d2d68ebbe602e6a2a (patch)
tree34a35b8a8c36e4909707b7a530ba2193c73685fa /src
parent3dc8c5985858db451ca4a2465ccd2b85ffd8f90f (diff)
ir3/ra: Fix corner case in collect handling
I ran into this when accidentally changing the scheduling order in the hl2 trace. Fixes: 0ffcb19 ("ir3: Rewrite register allocation") Part-of: <>
Diffstat (limited to 'src')
1 files changed, 13 insertions, 2 deletions
diff --git a/src/freedreno/ir3/ir3_ra.c b/src/freedreno/ir3/ir3_ra.c
index 2a43a21c0ef..c354acf86d4 100644
--- a/src/freedreno/ir3/ir3_ra.c
+++ b/src/freedreno/ir3/ir3_ra.c
@@ -1323,13 +1323,24 @@ handle_collect(struct ra_ctx *ctx, struct ir3_instruction *instr)
assign_src(ctx, instr, src);
+ /* We need to do this before insert_dst(), so that children of the
+ * destination which got marked as killed and then shuffled around to make
+ * space for the destination have the correct pcopy destination that
+ * matches what we assign the source of the collect to in assign_src().
+ *
+ * TODO: In this case we'll wind up copying the value in the pcopy and
+ * then again in the collect. We could avoid one of those by updating the
+ * pcopy destination to match up with the final location of the source
+ * after the collect and making the collect a no-op. However this doesn't
+ * seem to happen often.
+ */
+ insert_parallel_copy_instr(ctx, instr);
/* Note: insert_dst will automatically shuffle around any intervals that
* are a child of the collect by making them children of the collect.
insert_dst(ctx, instr->dsts[0]);
- insert_parallel_copy_instr(ctx, instr);
/* Parallel copies before RA should only be at the end of the block, for