From: Rob Clark Date: Fri, 24 Jan 2020 00:45:29 +0000 (-0800) Subject: freedreno/ir3: remove unused tex arg harder X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fb09020ef23cc87c1c3024add572cf0a571e8ddc;p=mesa.git freedreno/ir3: remove unused tex arg harder Just killing the SSA link isn't enough. It confuses RA, legalize, and postsched to see a bogus unused reg. Signed-off-by: Rob Clark Part-of: --- diff --git a/src/freedreno/ir3/ir3.c b/src/freedreno/ir3/ir3.c index b9bcf3b08bd..f8cfc6bb3c0 100644 --- a/src/freedreno/ir3/ir3.c +++ b/src/freedreno/ir3/ir3.c @@ -463,23 +463,15 @@ static int emit_cat5(struct ir3_instruction *instr, void *ptr, instr_cat5_t *cat5 = ptr; iassert((instr->regs_count == 2) || - (instr->regs_count == 3) || (instr->regs_count == 4)); + (instr->regs_count == 3) || + (instr->regs_count == 4)); - switch (instr->opc) { - case OPC_DSX: - case OPC_DSXPP_1: - case OPC_DSY: - case OPC_DSYPP_1: - case OPC_RGETPOS: - case OPC_RGETINFO: - iassert((instr->flags & IR3_INSTR_S2EN) == 0); - src1 = instr->regs[1]; - src2 = instr->regs_count > 2 ? instr->regs[2] : NULL; - break; - default: + if (instr->flags & IR3_INSTR_S2EN) { src1 = instr->regs[2]; src2 = instr->regs_count > 3 ? instr->regs[3] : NULL; - break; + } else { + src1 = instr->regs[1]; + src2 = instr->regs_count > 2 ? instr->regs[2] : NULL; } assume(src1 || !src2); diff --git a/src/freedreno/ir3/ir3_cp.c b/src/freedreno/ir3/ir3_cp.c index e04f1daae6b..28c9f82f3ae 100644 --- a/src/freedreno/ir3/ir3_cp.c +++ b/src/freedreno/ir3/ir3_cp.c @@ -723,7 +723,12 @@ instr_cp(struct ir3_cp_ctx *ctx, struct ir3_instruction *instr) instr->flags &= ~IR3_INSTR_S2EN; instr->cat5.samp = samp->regs[1]->iim_val; instr->cat5.tex = tex->regs[1]->iim_val; - instr->regs[1]->instr = NULL; + + /* shuffle around the regs to remove the first src: */ + instr->regs_count--; + for (unsigned i = 1; i < instr->regs_count; i++) { + instr->regs[i] = instr->regs[i + 1]; + } } } } diff --git a/src/freedreno/ir3/ir3_print.c b/src/freedreno/ir3/ir3_print.c index 244239dd240..381319311a3 100644 --- a/src/freedreno/ir3/ir3_print.c +++ b/src/freedreno/ir3/ir3_print.c @@ -206,10 +206,6 @@ print_instr(struct ir3_instruction *instr, int lvl) for (i = 0; i < instr->regs_count; i++) { struct ir3_register *reg = instr->regs[i]; - /* skip the samp/tex src if it has been lowered to immed: */ - if ((i == 1) && is_tex(instr) && !(instr->flags & IR3_INSTR_S2EN)) - continue; - printf(i ? ", " : ""); print_reg_name(reg); }