From 6dd751b3b94599f9948e86ec78e2c08163353f96 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Fri, 15 Sep 2023 12:06:48 +0100 Subject: [PATCH] aco: remove unused p_logical_end check when optimizing branching sequence MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Timur Kristóf Cc: mesa-stable Part-of: --- src/amd/compiler/aco_ssa_elimination.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/amd/compiler/aco_ssa_elimination.cpp b/src/amd/compiler/aco_ssa_elimination.cpp index 043221a..8064414 100644 --- a/src/amd/compiler/aco_ssa_elimination.cpp +++ b/src/amd/compiler/aco_ssa_elimination.cpp @@ -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); } -- 2.7.4