If it's already a register, there's no point in rewriting and it will
disturb the existing register, i.e. for
if (..) {
r0 = vecN ..
} else {
r0 = vecN ..
}
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5260>
bi_foreach_instr_in_block_safe(block, ins) {
if (ins->type != BI_COMBINE) continue;
- unsigned R = bi_make_temp_reg(ctx);
+ bool needs_rewrite = !(ins->dest & PAN_IS_REG);
+ unsigned R = needs_rewrite ? bi_make_temp_reg(ctx) : ins->dest;
unsigned sz = nir_alu_type_get_type_size(ins->dest_type);
bi_foreach_src(ins, s) {
}
}
+ if (needs_rewrite)
+ bi_rewrite_uses(ctx, ins->dest, 0, R, 0);
- bi_rewrite_uses(ctx, ins->dest, 0, R, 0);
bi_remove_instruction(ins);
}
}