From d25cf483cbfdd51627d96ffcff28adf7606122cd Mon Sep 17 00:00:00 2001 From: Connor Abbott Date: Fri, 23 Jul 2021 11:45:10 +0200 Subject: [PATCH] ir3: Copy-propagate single-source phis These can be created when removing unreachable control flow, and it seems easier to remove them than to add special code to handle them when spilling. Part-of: --- src/freedreno/ir3/ir3.h | 2 ++ src/freedreno/ir3/ir3_cp.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/freedreno/ir3/ir3.h b/src/freedreno/ir3/ir3.h index e0dd870971d..624a416e958 100644 --- a/src/freedreno/ir3/ir3.h +++ b/src/freedreno/ir3/ir3.h @@ -801,6 +801,8 @@ is_same_type_mov(struct ir3_instruction *instr) if (!is_same_type_reg(instr->dsts[0], instr->srcs[0])) return false; break; + case OPC_META_PHI: + return instr->srcs_count == 1; default: return false; } diff --git a/src/freedreno/ir3/ir3_cp.c b/src/freedreno/ir3/ir3_cp.c index 50c43f3303f..e496f1ede29 100644 --- a/src/freedreno/ir3/ir3_cp.c +++ b/src/freedreno/ir3/ir3_cp.c @@ -536,11 +536,12 @@ instr_cp(struct ir3_cp_ctx *ctx, struct ir3_instruction *instr) /* TODO non-indirect access we could figure out which register * we actually want and allow cp.. */ - if (reg->flags & IR3_REG_ARRAY) + if ((reg->flags & IR3_REG_ARRAY) && src->opc != OPC_META_PHI) continue; /* Don't CP absneg into meta instructions, that won't end well: */ - if (is_meta(instr) && (src->opc != OPC_MOV)) + if (is_meta(instr) && + (src->opc == OPC_ABSNEG_F || src->opc == OPC_ABSNEG_S)) continue; /* Don't CP mova and mova1 into their users */