nir: don't remove dead IO variables in nir_lower_io_passes for st_link_nir

We need to keep variables in the IR because a few places use them,
like nir_build_program_resource_list. This will allow us to lower IO
in the linker.

Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21861>
This commit is contained in:
Marek Olšák
2023-02-28 23:12:58 -05:00
committed by Marge Bot
parent f11118a36b
commit 28374b466c
3 changed files with 6 additions and 3 deletions
+1 -2
View File
@@ -3183,8 +3183,7 @@ nir_lower_io_passes(nir_shader *nir)
/* Lower and remove dead derefs and variables to clean up the IR. */
NIR_PASS_V(nir, nir_lower_vars_to_ssa);
NIR_PASS_V(nir, nir_opt_dce);
NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_function_temp |
nir_var_shader_in | nir_var_shader_out, NULL);
NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_function_temp, NULL);
if (nir->xfb_info)
NIR_PASS_V(nir, nir_io_add_intrinsic_xfb_info);
@@ -413,6 +413,7 @@ char *si_finalize_nir(struct pipe_screen *screen, void *nirptr)
struct nir_shader *nir = (struct nir_shader *)nirptr;
nir_lower_io_passes(nir);
NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_shader_in | nir_var_shader_out, NULL);
NIR_PASS_V(nir, ac_nir_lower_subdword_loads,
(ac_nir_lower_subdword_options) {
+4 -1
View File
@@ -1076,8 +1076,11 @@ st_finalize_nir(struct st_context *st, struct gl_program *prog,
/* Lower load_deref/store_deref of inputs and outputs.
* This depends on st_nir_assign_varying_locations.
*/
if (nir->options->lower_io_variables)
if (nir->options->lower_io_variables) {
nir_lower_io_passes(nir);
NIR_PASS_V(nir, nir_remove_dead_variables,
nir_var_shader_in | nir_var_shader_out, NULL);
}
/* Set num_uniforms in number of attribute slots (vec4s) */
nir->num_uniforms = DIV_ROUND_UP(prog->Parameters->NumParameterValues, 4);