aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>2019-07-19 19:11:09 (GMT)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>2019-07-22 15:20:34 (GMT)
commit076838ef0cba3bffd8d89a02146c2fcf18c30871 (patch)
tree9bcc0250a4b9c020abf9188e4b5a2c8b8d2bbf88
parent997f85c136882569e56b433292feb09dcd4d33fb (diff)
downloadexternal_mesa3d-076838ef0cba3bffd8d89a02146c2fcf18c30871.zip
external_mesa3d-076838ef0cba3bffd8d89a02146c2fcf18c30871.tar.gz
external_mesa3d-076838ef0cba3bffd8d89a02146c2fcf18c30871.tar.bz2
panfrost/midgard: Check write-before-read in liveness analysis
If we write to an index before reading it, the old copy we're checking liveness for isn't live in this block, even if it does get read later. Fixes abnormally high register pressure in shaders with loops. Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
-rw-r--r--src/panfrost/midgard/midgard_liveness.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/panfrost/midgard/midgard_liveness.c b/src/panfrost/midgard/midgard_liveness.c
index a18d8b9..899c8ea 100644
--- a/src/panfrost/midgard/midgard_liveness.c
+++ b/src/panfrost/midgard/midgard_liveness.c
@@ -60,11 +60,24 @@ is_live_after_successors(compiler_context *ctx, midgard_block *bl, int src)
succ->visited = true;
+ /* Within this block, check if it's overwritten first */
+ bool block_done = false;
+
mir_foreach_instr_in_block(succ, ins) {
if (midgard_is_live_in_instr(ins, src))
return true;
+
+ /* If written-before-use, we're gone */
+
+ if (ins->ssa_args.dest == src && ins->type == TAG_LOAD_STORE_4 && ins->load_store.op == midgard_op_ld_int4 && ins->load_store.unknown == 0x1EEA) {
+ block_done = true;
+ break;
+ }
}
+ if (block_done)
+ continue;
+
/* ...and also, check *its* successors */
if (is_live_after_successors(ctx, succ, src))
return true;