diff options
Diffstat (limited to 'src/broadcom/compiler/vir_opt_dead_code.c')
-rw-r--r-- | src/broadcom/compiler/vir_opt_dead_code.c | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/src/broadcom/compiler/vir_opt_dead_code.c b/src/broadcom/compiler/vir_opt_dead_code.c index 64c762c88db..fd1af944427 100644 --- a/src/broadcom/compiler/vir_opt_dead_code.c +++ b/src/broadcom/compiler/vir_opt_dead_code.c @@ -52,21 +52,10 @@ dce(struct v3d_compile *c, struct qinst *inst) } static bool -has_nonremovable_reads(struct v3d_compile *c, struct qinst *inst) -{ - for (int i = 0; i < vir_get_nsrc(inst); i++) { - if (inst->src[i].file == QFILE_VPM) - return true; - } - - return false; -} - -static bool can_write_to_null(struct v3d_compile *c, struct qinst *inst) { /* The SFU instructions must write to a physical register. */ - if (c->devinfo->ver >= 41 && v3d_qpu_uses_sfu(&inst->qpu)) + if (v3d_qpu_uses_sfu(&inst->qpu)) return false; return true; @@ -149,30 +138,25 @@ check_first_ldunifa(struct v3d_compile *c, } static bool -increment_unifa_address(struct v3d_compile *c, struct qblock *block, struct qinst *unifa) +increment_unifa_address(struct v3d_compile *c, struct qinst *unifa) { - struct qblock *current_block = c->cur_block; if (unifa->qpu.type == V3D_QPU_INSTR_TYPE_ALU && unifa->qpu.alu.mul.op == V3D_QPU_M_MOV) { c->cursor = vir_after_inst(unifa); - c->cur_block = block; struct qreg unifa_reg = vir_reg(QFILE_MAGIC, V3D_QPU_WADDR_UNIFA); vir_ADD_dest(c, unifa_reg, unifa->src[0], vir_uniform_ui(c, 4u)); vir_remove_instruction(c, unifa); - c->cur_block = current_block; return true; } if (unifa->qpu.type == V3D_QPU_INSTR_TYPE_ALU && unifa->qpu.alu.add.op == V3D_QPU_A_ADD) { c->cursor = vir_after_inst(unifa); - c->cur_block = block; struct qreg unifa_reg = vir_reg(QFILE_MAGIC, V3D_QPU_WADDR_UNIFA); struct qreg tmp = vir_ADD(c, unifa->src[1], vir_uniform_ui(c, 4u)); vir_ADD_dest(c, unifa_reg, unifa->src[0], tmp); vir_remove_instruction(c, unifa); - c->cur_block = current_block; return true; } @@ -200,7 +184,7 @@ vir_opt_dead_code(struct v3d_compile *c) vir_for_each_block(block, c) { struct qinst *last_flags_write = NULL; - + c->cur_block = block; vir_for_each_inst_safe(inst, block) { /* If this instruction reads the flags, we can't * remove the flags generation for it. @@ -246,7 +230,6 @@ vir_opt_dead_code(struct v3d_compile *c) } if (v3d_qpu_writes_flags(&inst->qpu) || - has_nonremovable_reads(c, inst) || (is_ldunifa && !is_first_ldunifa && !is_last_ldunifa)) { /* If we can't remove the instruction, but we * don't need its destination value, just @@ -276,7 +259,7 @@ vir_opt_dead_code(struct v3d_compile *c) */ if (is_first_ldunifa) { assert(unifa); - if (!increment_unifa_address(c, block, unifa)) + if (!increment_unifa_address(c, unifa)) continue; } |