Mesa (main): nir_to_tgsi: Do the required cleanup for nir_opt_find_array_copies().

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Apr 13 20:11:33 UTC 2022


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

Author: Emma Anholt <emma at anholt.net>
Date:   Tue Apr 12 10:33:14 2022 -0700

nir_to_tgsi: Do the required cleanup for nir_opt_find_array_copies().

If we made a copy deref, then we need to do dead-write elimination for the
pervious writes or we'll just emit the same copy deref again next time
around.  And, at the end of the opt loop, we need to lower copy derefs
because later passes (locals_to_regs, notably) depend on it.

Fixes infinite opt loop on fs-function-inout-array with virgl on NTT.

Reviewed-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15899>

---

 src/gallium/auxiliary/nir/nir_to_tgsi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/nir/nir_to_tgsi.c b/src/gallium/auxiliary/nir/nir_to_tgsi.c
index 20c3d7ffae4..ffbaaae4be5 100644
--- a/src/gallium/auxiliary/nir/nir_to_tgsi.c
+++ b/src/gallium/auxiliary/nir/nir_to_tgsi.c
@@ -3153,6 +3153,9 @@ ntt_optimize_nir(struct nir_shader *s, struct pipe_screen *screen)
       NIR_PASS(progress, s, nir_opt_dead_cf);
       NIR_PASS(progress, s, nir_opt_cse);
       NIR_PASS(progress, s, nir_opt_find_array_copies);
+      NIR_PASS(progress, s, nir_opt_copy_prop_vars);
+      NIR_PASS(progress, s, nir_opt_dead_write_vars);
+
       NIR_PASS(progress, s, nir_opt_if, true);
       NIR_PASS(progress, s, nir_opt_peephole_select,
                control_flow_depth == 0 ? ~0 : 8, true, true);
@@ -3185,8 +3188,9 @@ ntt_optimize_nir(struct nir_shader *s, struct pipe_screen *screen)
          .buffer_max = 0,
       };
       NIR_PASS(progress, s, nir_opt_offsets, &offset_options);
-
    } while (progress);
+
+   NIR_PASS_V(s, nir_lower_var_copies);
 }
 
 /* Scalarizes all 64-bit ALU ops.  Note that we only actually need to



More information about the mesa-commit mailing list