From 2fff1db5c85b019ab233282180e8638d6572cf88 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Wed, 16 Jul 2025 16:00:06 +0100 Subject: [PATCH] aco: don't both flip s_cselect and label uniform_bool Otherwise, the uniform_bool could point to a temporary which might be DCE'd, since it's not used by the s_cselect. fossil-db (navi21): Totals from 1 (0.00% of 79825) affected shaders: Instrs: 1267 -> 1269 (+0.16%) Latency: 91071 -> 91103 (+0.04%) SALU: 283 -> 285 (+0.71%) Signed-off-by: Rhys Perry Reviewed-by: Georg Lehmann Part-of: --- src/amd/compiler/aco_optimizer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index 126a716b975..3304e52fbbe 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -1945,8 +1945,7 @@ label_instruction(opt_ctx& ctx, aco_ptr& instr) if (instr->operands[0].constantEquals((unsigned)-1) && instr->operands[1].constantEquals(0)) { /* Found a cselect that operates on a uniform bool that comes from eg. s_cmp */ ctx.info[instr->definitions[0].tempId()].set_uniform_bool(instr->operands[2].getTemp()); - } - if (instr->operands[2].isTemp() && ctx.info[instr->operands[2].tempId()].is_scc_invert()) { + } else if (instr->operands[2].isTemp() && ctx.info[instr->operands[2].tempId()].is_scc_invert()) { /* Flip the operands to get rid of the scc_invert instruction */ std::swap(instr->operands[0], instr->operands[1]); instr->operands[2].setTemp(ctx.info[instr->operands[2].tempId()].temp);