From 3a98f484d146d31065794a2091fcddf584b1cb46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Thu, 28 Jan 2021 16:52:28 +0100 Subject: [PATCH] aco/ra: only create phi-affinities for killed operands If a phi-operand is not killed, it must be copied anyway. The additional affinity would only overwrite any potential better affinity that was already created Totals from 1067 (0.71% of 149839) affected shaders (GFX10.3): VGPRs: 68072 -> 68064 (-0.01%) CodeSize: 8252588 -> 8245220 (-0.09%); split: -0.12%, +0.03% Instrs: 1596146 -> 1593941 (-0.14%); split: -0.16%, +0.02% Latency: 18828176 -> 18823914 (-0.02%); split: -0.08%, +0.06% InvThroughput: 3575063 -> 3574787 (-0.01%); split: -0.05%, +0.04% VClause: 24345 -> 24325 (-0.08%); split: -0.16%, +0.07% Copies: 88712 -> 87398 (-1.48%); split: -1.77%, +0.29% Branches: 52067 -> 51364 (-1.35%); split: -1.38%, +0.03% Reviewed-by: Tony Wasserka Part-of: --- src/amd/compiler/aco_register_allocation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index 8b1d662ff69..736c3e786c6 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -2055,7 +2055,7 @@ void get_affinities(ra_ctx& ctx, std::vector& live_out_per_block) affinity_related.emplace_back(instr->definitions[0].getTemp()); affinity_related.emplace_back(instr->definitions[0].getTemp()); for (const Operand& op : instr->operands) { - if (op.isTemp() && op.regClass() == instr->definitions[0].regClass()) { + if (op.isTemp() && op.isKill() && op.regClass() == instr->definitions[0].regClass()) { affinity_related.emplace_back(op.getTemp()); temp_to_phi_ressources[op.tempId()] = phi_ressources.size(); }