From eea5959a22e4962ae20f0608ca7c0c5b0a87811f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 22 Nov 2025 16:40:06 -0500 Subject: [PATCH] nir/lower_io_passes: call nir_opt_undef to eliminate undef output stores If we do it here, we won't have to call nir_recompute_io_bases later again. Acked-by: Pierre-Eric Pelloux-Prayer Part-of: --- src/compiler/nir/nir_lower_io.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index f2f7f64be03..3610a9b4fca 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -1274,6 +1274,12 @@ nir_lower_io_passes(nir_shader *nir, bool renumber_vs_inputs) NIR_PASS(_, nir, nir_opt_dce); NIR_PASS(_, nir, nir_remove_dead_variables, nir_var_function_temp, NULL); + /* Output stores can have undef values. Eliminate those before + * nir_recompute_io_bases. This happens with separate shaders, which are + * usually not optimized further after this. + */ + NIR_PASS(_, nir, nir_opt_undef); + /* If IO is lowered before var->data.driver_location is assigned, driver * locations are all 0, which means IO bases are all 0. It's not necessary * to set driver_location before lowering IO because the only thing that