aco/optimizer_postRA: Don't assume all operand registers were written by same instr.

This assumption is no longer true since the post-RA optimizer
can work across blocks. It is now possible that some control
flow paths overwrite some but not all registers of an operand.

This commit may prevent invalid optimizations and/or assertion
failures (on debug builds).

Fossil DB stats unaffected on Navi 21.

Fixes: 0e4747d3fb
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18488>
This commit is contained in:
Timur Kristóf
2022-09-18 18:59:25 +02:00
committed by Marge Bot
parent 63063dd5ce
commit 2eab413cf7

View File

@@ -127,16 +127,7 @@ last_writer_idx(pr_opt_ctx& ctx, const Operand& op)
if (op.isConstant() || op.isUndefined())
return const_or_undef;
assert(op.physReg().reg() < max_reg_cnt);
Idx instr_idx = ctx.instr_idx_by_regs[ctx.current_block->index][op.physReg().reg()];
#ifndef NDEBUG
/* Debug mode: */
instr_idx = last_writer_idx(ctx, op.physReg(), op.regClass());
assert(instr_idx != written_by_multiple_instrs);
#endif
return instr_idx;
return last_writer_idx(ctx, op.physReg(), op.regClass());
}
bool