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 <alyssa.rosenzweig@collabora.com>
This commit is contained in:
Alyssa Rosenzweig 2019-08-05 18:17:27 -07:00
parent e333bf606f
commit a5059f2cba
1 changed files with 5 additions and 9 deletions

View File

@ -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;