radv: Run nir_opt_deref after first optimization loop

Only at this point are loads from uninitialized variables lowered to
undef and copy-propagated so that nir_opt_deref's cast-of-undef
optimization works properly.

Cc: mesa-stable
(cherry picked from commit 1f998b38f4)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41269>
This commit is contained in:
Natalie Vock 2026-04-14 13:20:36 +02:00 committed by Eric Engestrom
parent 0c44fd4220
commit bc69f4192b
2 changed files with 2 additions and 1 deletions

View file

@ -5874,7 +5874,7 @@
"description": "radv: Run nir_opt_deref after first optimization loop",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -771,6 +771,7 @@ radv_shader_spirv_to_nir(struct radv_device *device, const struct radv_shader_st
radv_optimize_nir(nir, false);
NIR_PASS(_, nir, nir_opt_memcpy);
NIR_PASS(_, nir, nir_opt_deref);
}
/* We call nir_lower_var_copies() after the first radv_optimize_nir()