From 7da07ca3e43b92852715ab1c9b3848cb49bac567 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Fri, 22 Nov 2019 14:17:27 +0000 Subject: [PATCH] aco: follow through temporary when merging tests into constant comparisons MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This can happen with v_mov_b32(s_mov_b32(literal)) pipeline-db (Navi): Totals from affected shaders: SGPRS: 632 -> 632 (0.00 %) VGPRS: 492 -> 492 (0.00 %) Spilled SGPRs: 0 -> 0 (0.00 %) Spilled VGPRs: 0 -> 0 (0.00 %) Code Size: 77488 -> 76928 (-0.72 %) bytes Max Waves: 67 -> 67 (0.00 %) Instructions: 14426 -> 14332 (-0.65 %) pipeline-db (Vega): Totals from affected shaders: SGPRS: 632 -> 632 (0.00 %) VGPRS: 492 -> 492 (0.00 %) Spilled SGPRs: 0 -> 0 (0.00 %) Spilled VGPRs: 0 -> 0 (0.00 %) Code Size: 77512 -> 76952 (-0.72 %) bytes Max Waves: 67 -> 67 (0.00 %) Instructions: 14432 -> 14338 (-0.65 %) Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_optimizer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index 61cb58d..8406a91 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -1394,7 +1394,8 @@ bool combine_constant_comparison_ordering(opt_ctx &ctx, aco_ptr& in if (cmp->operands[constant_operand].isConstant()) { constant = cmp->operands[constant_operand].constantValue(); } else if (cmp->operands[constant_operand].isTemp()) { - unsigned id = cmp->operands[constant_operand].tempId(); + Temp tmp = cmp->operands[constant_operand].getTemp(); + unsigned id = original_temp_id(ctx, tmp); if (!ctx.info[id].is_constant() && !ctx.info[id].is_literal()) return false; constant = ctx.info[id].val; -- 2.7.4