From 19583023a2c6c26fa406fa58ca3be4e92b6aae32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Mon, 30 Sep 2024 16:48:08 +0200 Subject: [PATCH] aco/ra: remove unnecessary check for duplicate precolored operands An instruction can have at most one operand precolored to the same register. Part-of: --- src/amd/compiler/aco_register_allocation.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index d2fe3616ddd..198fe6e74c7 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -2108,17 +2108,9 @@ handle_fixed_operands(ra_ctx& ctx, RegisterFile& register_file, continue; } - unsigned j; - bool found = false; - BITSET_FOREACH_SET (j, mask, i) { - if (instr->operands[j].tempId() == op.tempId() && - instr->operands[j].physReg() == op.physReg()) { - found = true; - break; - } - } - if (found) - continue; /* the copy is already added to the list */ + /* An instruction can have at most one operand precolored to the same register. */ + assert(std::none_of(parallelcopy.begin(), parallelcopy.end(), + [&](auto copy) { return copy.second.physReg() == op.physReg(); })); /* clear from register_file so fixed operands are not collected be collect_vars() */ tmp_file.clear(src, op.regClass()); // TODO: try to avoid moving block vars to src