diff options
author | Alyssa Rosenzweig <[email protected]> | 2019-08-05 18:17:27 -0700 |
---|---|---|
committer | Alyssa Rosenzweig <[email protected]> | 2019-08-12 12:43:01 -0700 |
commit | a5059f2cba8c51cb10dbf0961956c0675ecc0469 (patch) | |
tree | ee0d40f1ba27fe28d47230b88d67a1d3a0e2ba24 /src | |
parent | e333bf606f6cb7f6fd43dd24a62ea128651197a5 (diff) |
pan/midgard: Handle partial writes in liveness analysis
This allows liveness analysis within a loop to be more fine grained,
fixing RA failures with partial spilled movs within a loop, as well as
enabling a slight reduction of register pressure more generally:
total registers in shared programs: 350 -> 347 (-0.86%)
registers in affected programs: 12 -> 9 (-25.00%)
helped: 3
HURT: 0
helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1
helped stats (rel) min: 25.00% max: 25.00% x̄: 25.00% x̃: 25.00%
Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/panfrost/midgard/midgard_liveness.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/panfrost/midgard/midgard_liveness.c b/src/panfrost/midgard/midgard_liveness.c index 5fbab196d33..8ecb22ee273 100644 --- a/src/panfrost/midgard/midgard_liveness.c +++ b/src/panfrost/midgard/midgard_liveness.c @@ -46,23 +46,19 @@ 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; + unsigned overwritten_mask = 0; mir_foreach_instr_in_block(succ, ins) { - if (mir_has_arg(ins, src)) + /* Did we read any components that we haven't overwritten yet? */ + if (mir_mask_of_read_components(ins, src) & ~overwritten_mask) return true; /* If written-before-use, we're gone */ - if (ins->ssa_args.dest == src && ins->mask == 0xF) { - block_done = true; - break; - } + if (ins->ssa_args.dest == src) + overwritten_mask |= ins->mask; } - if (block_done) - continue; - /* ...and also, check *its* successors */ if (is_live_after_successors(ctx, succ, src)) return true; |