From 7fe84024cb0985c2ab676d3e83520e5213db05df Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Thu, 24 Apr 2025 14:01:39 +0100 Subject: [PATCH] aco: fix get_temp_reg_changes with clobbered operands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The spiller might have tried to spill a live-through first or second s_fmac_f32 operand, but this wouldn't have reduced the SGPRs if the third operand wasn't killed Signed-off-by: Rhys Perry Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13038 Fixes: d6cb45dbb039 ("aco/spill: Allow spilling live-through operands") Reviewed-by: Daniel Schürmann Part-of: --- src/amd/compiler/aco_live_var_analysis.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/amd/compiler/aco_live_var_analysis.cpp b/src/amd/compiler/aco_live_var_analysis.cpp index 85eb3173020..b58b2a8ce2e 100644 --- a/src/amd/compiler/aco_live_var_analysis.cpp +++ b/src/amd/compiler/aco_live_var_analysis.cpp @@ -67,6 +67,8 @@ RegisterDemand get_temp_reg_changes(Instruction* instr) for (Operand op : instr->operands) { if (op.isFirstKillBeforeDef() || op.isCopyKill()) available_def_space -= op.getTemp(); + else if (op.isClobbered() && !op.isKill()) + available_def_space -= op.getTemp(); } return available_def_space;