Mesa (main): microsoft/spirv_to_dxil: Remove dead IO vars at the end of dxil_spirv_nir_passes()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 8 15:57:27 UTC 2022


Module: Mesa
Branch: main
Commit: 424bb7357f7d59f559103f08b7ced91a567686f6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=424bb7357f7d59f559103f08b7ced91a567686f6

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Wed Jun  8 00:23:12 2022 -0700

microsoft/spirv_to_dxil: Remove dead IO vars at the end of dxil_spirv_nir_passes()

No need to keep them around if they're unused. Moreover, this should
allow the linking step to get rid of outputs when the next stage
doesn't use them.

Reviewed-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16221>

---

 src/microsoft/spirv_to_dxil/dxil_spirv_nir.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c b/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c
index 87addc0a42b..7537e72ff35 100644
--- a/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c
+++ b/src/microsoft/spirv_to_dxil/dxil_spirv_nir.c
@@ -665,7 +665,10 @@ dxil_spirv_nir_passes(nir_shader *nir,
    NIR_PASS_V(nir, dxil_nir_lower_bool_input);
    NIR_PASS_V(nir, dxil_nir_lower_ubo_array_one_to_static);
    NIR_PASS_V(nir, nir_opt_dce);
-   NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_uniform, NULL);
+   NIR_PASS_V(nir, nir_remove_dead_derefs);
+   NIR_PASS_V(nir, nir_remove_dead_variables,
+              nir_var_uniform | nir_var_shader_in | nir_var_shader_out,
+              NULL);
 
    if (nir->info.stage == MESA_SHADER_FRAGMENT) {
       dxil_sort_ps_outputs(nir);



More information about the mesa-commit mailing list