Mesa (staging/21.2): nir/lower_shader_calls: remove empty phis

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Aug 12 17:09:47 UTC 2021


Module: Mesa
Branch: staging/21.2
Commit: 6d2727b2dc350bad12e0eaa8efb1482968fd15e7
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d2727b2dc350bad12e0eaa8efb1482968fd15e7

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>
(cherry picked from commit 01b0935d315347cfd06bb5d8bb1a6b59913f94cc)

---

 .pick_status.json                         | 2 +-
 src/compiler/nir/nir_lower_shader_calls.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 4d4d7f59272..51ab287a53a 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4,7 +4,7 @@
         "description": "nir/lower_shader_calls: remove empty phis",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "8dfb240b1f063307aa5e53fb1bd0865105eef986"
     },
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