From cfb306b4e4b011921e896da652df40dbce385110 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Mon, 15 Aug 2022 17:14:11 +0100 Subject: [PATCH] aco: test branch opcode if removing it in try_optimize_branching_sequence MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We shouldn't remove a p_cbranch_nz branch in this situation. Signed-off-by: Rhys Perry Reviewed-by: Georg Lehmann Reviewed-by: Timur Kristóf Fixes: b731be2e96c ("aco: Remove branch instruction when exec is constant non-zero.") Part-of: --- src/amd/compiler/aco_ssa_elimination.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amd/compiler/aco_ssa_elimination.cpp b/src/amd/compiler/aco_ssa_elimination.cpp index f49b676fc89..9d14092aa3e 100644 --- a/src/amd/compiler/aco_ssa_elimination.cpp +++ b/src/amd/compiler/aco_ssa_elimination.cpp @@ -502,7 +502,7 @@ try_optimize_branching_sequence(ssa_elimination_ctx& ctx, Block& block, const in exec_val->operands[0].constantValue()) { /* Remove the branch instruction when exec is constant non-zero. */ aco_ptr& branch = block.instructions.back(); - if (branch->isBranch() && branch->operands.size() && branch->operands[0].physReg() == exec) + if (branch->opcode == aco_opcode::p_cbranch_z && branch->operands[0].physReg() == exec) block.instructions.back().reset(); }