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 <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38598>
This commit is contained in:
Marek Olšák 2025-11-22 16:40:06 -05:00
parent 88ae1f8533
commit eea5959a22

View file

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