From 97213d180e4e137b553010c1863aa0b98d68739a Mon Sep 17 00:00:00 2001 From: Job Noorman Date: Fri, 3 Apr 2026 08:18:08 +0200 Subject: [PATCH] nir/opt_varyings: fix alu def cloning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit nir_builder_alu_instr_finish_and_insert initialized the def's bit_size and num_components so we should set them afterwards. Signed-off-by: Job Noorman Reviewed-by: Marek Olšák Reviewed-by: Emma Anholt Fixes: c66967b5cb7 ("nir: add nir_opt_varyings, new pass optimizing and compacting varyings") (cherry picked from commit 273fd18b89fe97dd5adff12cf229dfa7e804cb96) Part-of: --- .pick_status.json | 2 +- src/compiler/nir/nir_opt_varyings.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index cecf0c62bb2..edaae822fe7 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -4754,7 +4754,7 @@ "description": "nir/opt_varyings: fix alu def cloning", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "c66967b5cb7aa69c3c2efb12730b7b570483e01b", "notes": null diff --git a/src/compiler/nir/nir_opt_varyings.c b/src/compiler/nir/nir_opt_varyings.c index af98a1d47af..52f0b46df28 100644 --- a/src/compiler/nir/nir_opt_varyings.c +++ b/src/compiler/nir/nir_opt_varyings.c @@ -2258,11 +2258,11 @@ clone_ssa_impl(struct linkage_info *linkage, nir_builder *b, nir_def *ssa) NIR_MAX_VEC_COMPONENTS); } + clone = nir_builder_alu_instr_finish_and_insert(b, alu_clone); + alu_clone->def.num_components = alu->def.num_components; alu_clone->def.bit_size = alu->def.bit_size; - clone = nir_builder_alu_instr_finish_and_insert(b, alu_clone); - /* nir_builder_alu_instr_finish_and_insert overwrites fp_math_ctrl. */ alu_clone->fp_math_ctrl = alu->fp_math_ctrl; alu_clone->no_signed_wrap = alu->no_signed_wrap;