aco/optimizer_postRA: Initialize loop header with preheader information

This works because of SSA and should be safer than just setting 'not_written_yet'.

No Fossil DB changes on Rembrandt (RDNA2).

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16161>
This commit is contained in:
Daniel Schürmann 2022-11-14 18:04:23 +01:00 committed by Timur Kristóf
parent 8f4eccb138
commit d3b0f78110

View file

@ -107,9 +107,17 @@ struct pr_opt_ctx {
current_block = block;
current_instr_idx = 0;
if ((block->kind & block_kind_loop_header) || block->linear_preds.empty()) {
if (block->linear_preds.empty()) {
std::fill(instr_idx_by_regs[block->index].begin(), instr_idx_by_regs[block->index].end(),
not_written_yet);
} else if (block->kind & block_kind_loop_header) {
/* Initialize with content from loop preheader */
memcpy(&instr_idx_by_regs[block->index][0], &instr_idx_by_regs[block->index - 1][0],
max_reg_cnt * sizeof(Idx));
/* Assume exec writes on back-edges */
instr_idx_by_regs[block->index][126] = overwritten_untrackable;
instr_idx_by_regs[block->index][127] = overwritten_untrackable;
} else {
reset_block_regs(block->linear_preds, block->index, 0, max_sgpr_cnt);
reset_block_regs(block->linear_preds, block->index, 251, 3);