nir/opt_varyings: fix alu def cloning

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 <jnoorman@igalia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Fixes: c66967b5cb ("nir: add nir_opt_varyings, new pass optimizing and compacting varyings")
(cherry picked from commit 273fd18b89)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
This commit is contained in:
Job Noorman 2026-04-03 08:18:08 +02:00 committed by Eric Engestrom
parent 0347549074
commit 97213d180e
2 changed files with 3 additions and 3 deletions

View file

@ -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

View file

@ -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;