From 0eb7c49c7f5d429b6d322ff751625b84afa644a6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timur=20Krist=C3=B3f?= Date: Mon, 3 Apr 2023 00:05:09 +0200 Subject: [PATCH] aco: Pop branch operands when targets are same in SSA elimination. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The branch instruction is no longer conditional when the targets are the same, so the operand is not necessary and can be removed. Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_ssa_elimination.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/amd/compiler/aco_ssa_elimination.cpp b/src/amd/compiler/aco_ssa_elimination.cpp index a1c3c4a..5bd545c 100644 --- a/src/amd/compiler/aco_ssa_elimination.cpp +++ b/src/amd/compiler/aco_ssa_elimination.cpp @@ -270,8 +270,12 @@ try_remove_simple_block(ssa_elimination_ctx& ctx, Block* block) assert(false); } - if (branch.target[0] == branch.target[1]) + if (branch.target[0] == branch.target[1]) { + while (branch.operands.size()) + branch.operands.pop_back(); + branch.opcode = aco_opcode::p_branch; + } for (unsigned i = 0; i < pred.linear_succs.size(); i++) if (pred.linear_succs[i] == block->index) -- 2.7.4