From 92b1154397f61d06a5a98a95c705d3e75ca0d893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Fri, 23 May 2025 14:54:10 +0200 Subject: [PATCH] aco/ra: Always rename copy-kill operands, even if the temporary doesn't match This makes it independent of whether the operand already got renamed or not. Part-of: --- src/amd/compiler/aco_register_allocation.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/amd/compiler/aco_register_allocation.cpp b/src/amd/compiler/aco_register_allocation.cpp index f6de4c82b6d..f88ac363dd2 100644 --- a/src/amd/compiler/aco_register_allocation.cpp +++ b/src/amd/compiler/aco_register_allocation.cpp @@ -879,9 +879,6 @@ update_renames(ra_ctx& ctx, RegisterFile& reg_file, std::vector& p if (is_def) continue; - /* The loop below might change this if is_copy_kill=true, but we will want the original */ - Operand copy_op = it->op; - /* Check if we moved another parallelcopy definition. We use a different path for copy-kill * copies, since they are able to exist alongside a normal copy with the same operand. */ @@ -919,7 +916,10 @@ update_renames(ra_ctx& ctx, RegisterFile& reg_file, std::vector& p ctx.assignments.emplace_back(copy.def.physReg(), copy.def.regClass()); assert(ctx.assignments.size() == ctx.program->peekAllocationId()); - /* check if we moved an operand */ + /* Check if we moved an operand: + * For copy-kill operands, use the current Operand name so that kill flags stay correct. + */ + Operand copy_op = is_copy_kill ? instr->operands[copy.copy_kill] : it->op; bool first[2] = {true, true}; bool fill = !is_copy_kill; for (unsigned i = 0; i < instr->operands.size(); i++) {