aco: remove unused p_logical_end check when optimizing branching sequence

I don't see why a p_logical_end is expected or required. It might not be
present in some situations, which causes an assertion failure:
 s2: %19646:s[0-1] = p_reload %19701:v[8], 11
 s2: %0:exec,  s1: %8817:scc = s_andn2_b64 %19646:s[0-1], %0:exec
 s2: %8818:s[20-21] = p_cbranch_z %0:exec BB1116, BB1114

No fossil-db changes (gfx1100).

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25244>
(cherry picked from commit 6dd751b3b9)
This commit is contained in:
Rhys Perry 2023-09-15 12:06:48 +01:00 committed by Eric Engestrom
parent 34fdfd80b4
commit 2d0d12c851
2 changed files with 3 additions and 6 deletions

View file

@ -499,7 +499,7 @@
"description": "aco: remove unused p_logical_end check when optimizing branching sequence",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -568,7 +568,6 @@ eliminate_useless_exec_writes_in_block(ssa_elimination_ctx& ctx, Block& block)
/* Collect information about the branching sequence. */
bool logical_end_found = false;
bool branch_exec_val_found = false;
int branch_exec_val_idx = -1;
int branch_exec_copy_idx = -1;
@ -590,8 +589,6 @@ eliminate_useless_exec_writes_in_block(ssa_elimination_ctx& ctx, Block& block)
(instr->opcode == aco_opcode::p_logical_end && !ctx.logical_phi_info[block.index].empty());
bool writes_exec = instr_writes_exec(instr.get());
logical_end_found |= instr->opcode == aco_opcode::p_logical_end;
/* See if we found an unused exec write. */
if (writes_exec && !exec_write_used) {
/* Don't eliminate an instruction that writes registers other than exec and scc.
@ -609,7 +606,7 @@ eliminate_useless_exec_writes_in_block(ssa_elimination_ctx& ctx, Block& block)
/* For a newly encountered exec write, clear the used flag. */
if (writes_exec) {
if (!logical_end_found && instr->operands.size() && !branch_exec_val_found) {
if (instr->operands.size() && !branch_exec_val_found) {
/* We are in a branch that jumps according to exec.
* We just found the instruction that copies to exec before the branch.
*/
@ -647,7 +644,7 @@ eliminate_useless_exec_writes_in_block(ssa_elimination_ctx& ctx, Block& block)
/* See if we can optimize the instruction that produces the exec mask. */
if (branch_exec_val_idx != -1) {
assert(logical_end_found && branch_exec_tempid && branch_exec_copy_idx != -1);
assert(branch_exec_tempid && branch_exec_copy_idx != -1);
try_optimize_branching_sequence(ctx, block, branch_exec_val_idx, branch_exec_copy_idx);
}