Module: Mesa Branch: main Commit: d25cf483cbfdd51627d96ffcff28adf7606122cd URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d25cf483cbfdd51627d96ffcff28adf7606122cd
Author: Connor Abbott <[email protected]> Date: Fri Jul 23 11:45:10 2021 +0200 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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12033> --- 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 */
