From 0f178290caf6ee7ea33ef3293fc953870f4a6c5c Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Tue, 26 Jan 2021 14:24:48 +0000 Subject: [PATCH] aco: don't affect isPrecise() after applying output modifiers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fossil-db (GFX10.3): Totals from 26679 (19.14% of 139391) affected shaders: SGPRs: 1757155 -> 1757059 (-0.01%); split: -0.05%, +0.04% VGPRs: 1175932 -> 1173556 (-0.20%); split: -0.21%, +0.01% CodeSize: 86203592 -> 85572480 (-0.73%); split: -0.73%, +0.00% MaxWaves: 315513 -> 315805 (+0.09%); split: +0.10%, -0.00% Instrs: 16297785 -> 16143745 (-0.95%); split: -0.95%, +0.00% Signed-off-by: Rhys Perry Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_ir.h | 4 ++++ src/amd/compiler/aco_optimizer.cpp | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/amd/compiler/aco_ir.h b/src/amd/compiler/aco_ir.h index 94564ffa2cb..8f0e2f13f98 100644 --- a/src/amd/compiler/aco_ir.h +++ b/src/amd/compiler/aco_ir.h @@ -884,6 +884,10 @@ public: temp = t; } + void swapTemp(Definition& other) noexcept { + std::swap(temp, other.temp); + } + constexpr RegClass regClass() const noexcept { return temp.regClass(); diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index 4266696b9fb..d804faf1d8f 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -2674,7 +2674,7 @@ bool apply_omod_clamp(opt_ctx &ctx, Block& block, aco_ptr& instr) return false; } - std::swap(instr->definitions[0], def_info.instr->definitions[0]); + instr->definitions[0].swapTemp(def_info.instr->definitions[0]); ctx.info[instr->definitions[0].tempId()].label &= label_clamp; ctx.uses[def_info.instr->definitions[0].tempId()]--; @@ -2806,7 +2806,7 @@ void combine_vop3p(opt_ctx &ctx, Block& block, aco_ptr& instr) VOP3P_instruction* candidate = &ctx.info[instr->operands[0].tempId()].instr->vop3p(); candidate->clamp = true; propagate_swizzles(candidate, vop3p->opsel_lo, vop3p->opsel_hi); - std::swap(instr->definitions[0], candidate->definitions[0]); + instr->definitions[0].swapTemp(candidate->definitions[0]); ctx.info[candidate->definitions[0].tempId()].instr = candidate; ctx.uses[instr->definitions[0].tempId()]--; return;