aco/optimizer_postRA: Mark a register overwritten when predecessors disagree.
authorTimur Kristóf <timur.kristof@gmail.com>
Fri, 16 Sep 2022 11:54:54 +0000 (13:54 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 21 Sep 2022 16:56:57 +0000 (16:56 +0000)
Affects blocks whose some (but not all) predecessors overwrite a register.
This commit fixes glitches in some games which regressed because of the
improved SCC no-compare optimization.

Fossil DB stats on Navi 21:

Totals from 2816 (2.09% of 134906) affected shaders:
CodeSize: 24224276 -> 24241580 (+0.07%)
Instrs: 4570595 -> 4574921 (+0.09%)
Latency: 53680256 -> 53693655 (+0.02%); split: -0.00%, +0.02%
InvThroughput: 9829289 -> 9830573 (+0.01%)

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7257
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7305
Fixes: 2e56e2342094e8ec90afa5265b1c43503f662939
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18488>

src/amd/compiler/aco_optimizer_postRA.cpp

index 2c4ab83..1d6f6f7 100644 (file)
@@ -76,7 +76,7 @@ struct pr_opt_ctx {
             if (all_same)
                instr_idx_by_regs[block->index][i] = instr_idx_by_regs[first_pred][i];
             else
-               instr_idx_by_regs[block->index][i] = not_written_in_block;
+               instr_idx_by_regs[block->index][i] = written_by_multiple_instrs;
          }
       }
    }