ir3/sched: Consider unused destinations when computing live effect
authorConnor Abbott <cwabbott0@gmail.com>
Mon, 26 Apr 2021 21:37:04 +0000 (23:37 +0200)
committerEmma Anholt <emma@anholt.net>
Thu, 10 Jun 2021 19:24:06 +0000 (12:24 -0700)
If an instruction's destination is unused, then we shouldn't penalize
it. For example, this helps us schedule atomic operations whose results
aren't read. This works around RA failures when CSE is enabled in some
robustness2 tests.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9842>

src/freedreno/ir3/ir3_sched.c

index a51399e..a5509af 100644 (file)
@@ -501,7 +501,7 @@ static int
 live_effect(struct ir3_instruction *instr)
 {
        struct ir3_sched_node *n = instr->data;
-       int new_live = n->partially_live ? 0 : dest_regs(instr);
+       int new_live = (n->partially_live || !instr->uses || instr->uses->entries == 0) ? 0 : dest_regs(instr);
        int freed_live = 0;
 
        /* if we schedule something that causes a vecN to be live,