Mesa (main): nir/lower_shader_calls: remove empty phis

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 11 13:34:54 UTC 2021


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

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Mon Jul 19 19:33:12 2021 +0300

nir/lower_shader_calls: remove empty phis

This is confusing opt_cse.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Fixes: 8dfb240b1f0633 ("nir: Add raytracing shader call lowering pass.")
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11953>

---

 src/compiler/nir/nir_lower_shader_calls.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compiler/nir/nir_lower_shader_calls.c b/src/compiler/nir/nir_lower_shader_calls.c
index e1398bf25ae..40e8d621b97 100644
--- a/src/compiler/nir/nir_lower_shader_calls.c
+++ b/src/compiler/nir/nir_lower_shader_calls.c
@@ -1108,6 +1108,8 @@ nir_lower_shader_calls(nir_shader *shader,
    NIR_PASS_V(shader, spill_ssa_defs_and_lower_shader_calls,
               num_calls, address_format, stack_alignment);
 
+   nir_opt_remove_phis(shader);
+
    /* Make N copies of our shader */
    nir_shader **resume_shaders = ralloc_array(mem_ctx, nir_shader *, num_calls);
    for (unsigned i = 0; i < num_calls; i++)
@@ -1117,6 +1119,7 @@ nir_lower_shader_calls(nir_shader *shader,
    for (unsigned i = 0; i < num_calls; i++) {
       nir_instr *resume_instr = lower_resume(resume_shaders[i], i);
       replace_resume_with_halt(resume_shaders[i], resume_instr);
+      nir_opt_remove_phis(resume_shaders[i]);
    }
 
    *resume_shaders_out = resume_shaders;



More information about the mesa-commit mailing list