aco: Mark exec write used when it writes other registers.

When an exec write isn't used but writes other registers
besides exec, and also reads exec (such as s_and_saveexec),
we would mistakenly delete the previous instruction that
writes the exec value that this instruction uses.

No Fossil DB changes on Rembrandt (GFX10.3).

Fixes: 0211e66f65
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9036
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23576>
(cherry picked from commit 67a0f2532f)
This commit is contained in:
Timur Kristóf 2023-06-11 16:01:17 +02:00 committed by Eric Engestrom
parent ddcfd03212
commit 20448890ff
2 changed files with 4 additions and 3 deletions

View file

@ -2317,7 +2317,7 @@
"description": "aco: Mark exec write used when it writes other registers.",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "0211e66f65522caa1f6855b937ae4fc18af0c937"
},

View file

@ -604,9 +604,10 @@ eliminate_useless_exec_writes_in_block(ssa_elimination_ctx& ctx, Block& block)
bool writes_other = std::any_of(instr->definitions.begin(), instr->definitions.end(),
[](const Definition& def) -> bool
{ return def.physReg() != exec && def.physReg() != scc; });
if (!writes_other)
if (!writes_other) {
instr.reset();
continue;
continue;
}
}
/* For a newly encountered exec write, clear the used flag. */