Mesa (staging/21.2): nir/builder: invalidate metadata per function

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


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

Author: Marcin Ślusarz <marcin.slusarz at intel.com>
Date:   Fri Aug  6 12:14:38 2021 +0200

nir/builder: invalidate metadata per function

Fixes: a62098fff20 ("nir: Add a helper for general instruction-modifying passes.")
Signed-off-by: Marcin Ślusarz <marcin.slusarz at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12324>
(cherry picked from commit e1b325f58730d8fd82829c538c9e83aa193c4eba)

---

 .pick_status.json              | 2 +-
 src/compiler/nir/nir_builder.h | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 5148197a0de..4d4d7f59272 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -94,7 +94,7 @@
         "description": "nir/builder: invalidate metadata per function",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "a62098fff202f5e6c689aa6e78ace67c50f17c8e"
     },
diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h
index 2551da45f9f..0beb2731eb6 100644
--- a/src/compiler/nir/nir_builder.h
+++ b/src/compiler/nir/nir_builder.h
@@ -103,17 +103,19 @@ nir_shader_instructions_pass(nir_shader *shader,
       if (!function->impl)
          continue;
 
+      bool func_progress = false;
       nir_builder b;
       nir_builder_init(&b, function->impl);
 
       nir_foreach_block_safe(block, function->impl) {
          nir_foreach_instr_safe(instr, block) {
-            progress |= pass(&b, instr, cb_data);
+            func_progress |= pass(&b, instr, cb_data);
          }
       }
 
-      if (progress) {
+      if (func_progress) {
          nir_metadata_preserve(function->impl, preserved);
+         progress = true;
       } else {
          nir_metadata_preserve(function->impl, nir_metadata_all);
       }



More information about the mesa-commit mailing list