From b133496b1068d457dcbd14fe0c923e3d81b1bade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Wed, 24 Aug 2022 12:55:12 +0200 Subject: [PATCH] aco/optimizer: disallow can_eliminate_and_exec() with s_not MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Totals from 295 (0.22% of 134913) affected shaders: (GFX10.3) CodeSize: 1016564 -> 1016896 (+0.03%); split: -0.05%, +0.09% Instrs: 187659 -> 187724 (+0.03%); split: -0.08%, +0.11% Latency: 2839516 -> 2839541 (+0.00%); split: -0.01%, +0.01% Copies: 12301 -> 12305 (+0.03%); split: -0.01%, +0.04% PreSGPRs: 10266 -> 10268 (+0.02%) Closes: #7024 Cc: mesa-stable Tested-by: Konstantin Seurer Reviewed-by: Timur Kristóf Part-of: (cherry picked from commit 98e3c446d89ab24bdad6cdb779860895d7dd8d31) --- .pick_status.json | 2 +- src/amd/compiler/aco_optimizer.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 900f26a967f..6e657f167b8 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2740,7 +2740,7 @@ "description": "aco/optimizer: disallow can_eliminate_and_exec() with s_not", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index d8337418e22..a3f8555e15e 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -1215,12 +1215,12 @@ can_eliminate_and_exec(opt_ctx& ctx, Temp tmp, unsigned pass_flags) } if (ctx.info[tmp.id()].is_bitwise()) { Instruction* instr = ctx.info[tmp.id()].instr; - if (instr->pass_flags != pass_flags) + if (instr->operands.size() != 2 || instr->pass_flags != pass_flags) return false; - return std::all_of( - instr->operands.begin(), instr->operands.end(), - [&](const Operand& op) - { return op.isTemp() && can_eliminate_and_exec(ctx, op.getTemp(), pass_flags); }); + if (!(instr->operands[0].isTemp() && instr->operands[1].isTemp())) + return false; + return can_eliminate_and_exec(ctx, instr->operands[0].getTemp(), pass_flags) && + can_eliminate_and_exec(ctx, instr->operands[1].getTemp(), pass_flags); } return false; }