Mesa (main): nir: call nir_metadata_preserve in nir_io_add_const_offset_to_base

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu May 19 14:36:43 UTC 2022


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

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Wed Aug 18 14:19:32 2021 +0100

nir: call nir_metadata_preserve in nir_io_add_const_offset_to_base

This is necessary to use this pass with the NIR_PASS() macro.

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12448>

---

 src/compiler/nir/nir_lower_io.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c
index d7aaad6af8c..5e3b866ff20 100644
--- a/src/compiler/nir/nir_lower_io.c
+++ b/src/compiler/nir/nir_lower_io.c
@@ -2827,11 +2827,17 @@ nir_io_add_const_offset_to_base(nir_shader *nir, nir_variable_mode modes)
 
    nir_foreach_function(f, nir) {
       if (f->impl) {
+         bool impl_progress = false;
          nir_builder b;
          nir_builder_init(&b, f->impl);
          nir_foreach_block(block, f->impl) {
-            progress |= add_const_offset_to_base_block(block, &b, modes);
+            impl_progress |= add_const_offset_to_base_block(block, &b, modes);
          }
+         progress |= impl_progress;
+         if (impl_progress)
+            nir_metadata_preserve(f->impl, nir_metadata_block_index | nir_metadata_dominance);
+         else
+            nir_metadata_preserve(f->impl, nir_metadata_all);
       }
    }
 



More information about the mesa-commit mailing list