X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fdrivers%2Fvc4%2Fvc4_opt_dead_code.c;h=d3562ee947e6bfaed7572997298651bc1425fffa;hb=d794072b3e1f27b96aaf2c476fcd5dcc5fd9d445;hp=ffd42422de8c7fcfa34f7d808ea770fa8ebebca6;hpb=78c773bb3646295e4a4f1fe7d6d10f05758ee48b;p=mesa.git diff --git a/src/gallium/drivers/vc4/vc4_opt_dead_code.c b/src/gallium/drivers/vc4/vc4_opt_dead_code.c index ffd42422de8..d3562ee947e 100644 --- a/src/gallium/drivers/vc4/vc4_opt_dead_code.c +++ b/src/gallium/drivers/vc4/vc4_opt_dead_code.c @@ -69,7 +69,7 @@ has_nonremovable_reads(struct vc4_compile *c, struct qinst *inst) } if (inst->src[i].file == QFILE_VARY && - c->input_semantics[inst->src[i].index].semantic == 0xff) { + c->input_slots[inst->src[i].index].slot == 0xff) { return true; } } @@ -83,26 +83,14 @@ qir_opt_dead_code(struct vc4_compile *c) bool progress = false; bool *used = calloc(c->num_temps, sizeof(bool)); bool sf_used = false; - /* Whether we're eliminating texture setup currently. */ - bool dce_tex = false; - - struct list_head *node, *t; - for (node = c->instructions.prev, t = node->prev; - &c->instructions != node; - node = t, t = t->prev) { - struct qinst *inst = (struct qinst *)node; + list_for_each_entry_safe_rev(struct qinst, inst, &c->instructions, + link) { if (inst->dst.file == QFILE_TEMP && !used[inst->dst.index] && !inst->sf && - (!qir_has_side_effects(c, inst) || - inst->op == QOP_TEX_RESULT) && + !qir_has_side_effects(c, inst) && !has_nonremovable_reads(c, inst)) { - if (inst->op == QOP_TEX_RESULT) { - dce_tex = true; - c->num_texture_samples--; - } - for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) { if (inst->src[i].file != QFILE_VPM) continue; @@ -136,19 +124,6 @@ qir_opt_dead_code(struct vc4_compile *c) sf_used = false; } - if (inst->op == QOP_TEX_RESULT) - dce_tex = false; - - if (dce_tex && (inst->op == QOP_TEX_S || - inst->op == QOP_TEX_T || - inst->op == QOP_TEX_R || - inst->op == QOP_TEX_B || - inst->op == QOP_TEX_DIRECT)) { - dce(c, inst); - progress = true; - continue; - } - for (int i = 0; i < qir_get_op_nsrc(inst->op); i++) { if (inst->src[i].file == QFILE_TEMP) used[inst->src[i].index] = true;