From 8e43abcd2c29366d77fff804a7845b61fb97ca5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Thu, 25 Mar 2021 09:29:55 +0000 Subject: [PATCH] aco/ra: remove exec handling for phis These are not temporaries anymore. Reviewed-by: Tony Wasserka Part-of: --- src/amd/compiler/aco_register_allocation.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index f9bdf636865..81448b940ca 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -2102,17 +2102,14 @@ void register_allocation(Program *program, std::vector& live_out_per_bloc ctx.assignments[ctx.affinities[definition.tempId()]].assigned) { assert(ctx.assignments[ctx.affinities[definition.tempId()]].rc == definition.regClass()); PhysReg reg = ctx.assignments[ctx.affinities[definition.tempId()]].reg; - bool try_use_special_reg = reg == scc || reg == exec; - if (try_use_special_reg) { - for (const Operand& op : phi->operands) { - if (!(op.isTemp() && op.isFixed() && op.physReg() == reg)) { - try_use_special_reg = false; - break; - } - } - if (!try_use_special_reg) + if (reg == scc) { + /* only use scc if all operands are already placed there */ + bool use_scc = std::all_of(phi->operands.begin(), phi->operands.end(), + [] (const Operand& op) { return op.isTemp() && op.isFixed() && op.physReg() == scc;}); + if (!use_scc) continue; } + /* only assign if register is still free */ if (!register_file.test(reg, definition.bytes())) { definition.setFixed(reg); @@ -2138,11 +2135,11 @@ void register_allocation(Program *program, std::vector& live_out_per_bloc for (int i = phi->operands.size() - 1; i >= 0; i--) { /* by going backwards, we aim to avoid copies in else-blocks */ const Operand& op = phi->operands[i]; - if (!(op.isTemp() && op.isFixed())) + if (!op.isTemp() || !op.isFixed()) continue; PhysReg reg = op.physReg(); /* we tried this already on the previous loop */ - if (reg == scc || reg == exec) + if (reg == scc) continue; if (get_reg_specified(ctx, register_file, definition.regClass(), phi, reg)) { definition.setFixed(reg);