ctx->inputs[idx] = instr;
}
} else if (ctx->so->type == MESA_SHADER_VERTEX) {
- struct ir3_instruction *input = NULL, *in;
+ struct ir3_instruction *input = NULL;
struct ir3_instruction *components[4];
unsigned mask = (1 << (ncomp + frac)) - 1;
so->outputs[j] = so->outputs[i];
/* fixup outidx to point to new output table entry: */
- struct ir3_instruction *out;
foreach_output (out, ir) {
if (out->collect.outidx == i) {
out->collect.outidx = j;
struct ir3_context *ctx;
struct ir3 *ir;
int ret = 0, max_bary;
+ bool progress;
assert(!so->ir);
ir3_debug_print(ir, "AFTER: nir->ir3");
- IR3_PASS(ir, ir3_cf);
- IR3_PASS(ir, ir3_cp, so);
+ do {
+ progress = false;
+
+ progress |= IR3_PASS(ir, ir3_cf);
+ progress |= IR3_PASS(ir, ir3_cp, so);
+ progress |= IR3_PASS(ir, ir3_dce, so);
+ } while (progress);
/* at this point, for binning pass, throw away unneeded outputs:
* Note that for a6xx and later, we do this after ir3_cp to ensure
* that the uniform/constant layout for BS and VS matches, so that
* we can re-use same VS_CONST state group.
*/
- if (so->binning_pass && (ctx->compiler->gpu_id >= 600))
+ if (so->binning_pass && (ctx->compiler->gpu_id >= 600)) {
fixup_binning_pass(ctx);
+ /* cleanup the result of removing unneeded outputs: */
+ while (IR3_PASS(ir, ir3_dce, so)) {}
+ }
IR3_PASS(ir, ir3_sched_add_deps);
*/
IR3_PASS(ir, ir3_group);
- IR3_PASS(ir, ir3_dce, so);
+ /* At this point, all the dead code should be long gone: */
+ assert(!IR3_PASS(ir, ir3_dce, so));
ret = ir3_sched(ir);
if (ret) {
ret = ir3_ra(so, precolor, ARRAY_SIZE(precolor));
} else if (so->num_sampler_prefetch) {
assert(so->type == MESA_SHADER_FRAGMENT);
- struct ir3_instruction *instr, *precolor[2];
+ struct ir3_instruction *precolor[2];
int idx = 0;
foreach_input (instr, ir) {
for (unsigned i = 0; i < so->outputs_count; i++)
so->outputs[i].regid = INVALID_REG;
- struct ir3_instruction *out;
foreach_output (out, ir) {
assert(out->opc == OPC_META_COLLECT);
unsigned outidx = out->collect.outidx;
so->outputs[outidx].half = !!(out->regs[0]->flags & IR3_REG_HALF);
}
- struct ir3_instruction *in;
foreach_input (in, ir) {
assert(in->opc == OPC_META_INPUT);
unsigned inidx = in->input.inidx;