Mesa (main): nir: call nir_metadata_preserve at nir_remove_unused_io_vars

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 20 12:34:52 UTC 2022


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

Author: Alejandro Piñeiro <apinheiro at igalia.com>
Date:   Mon Jul 18 15:28:16 2022 +0200

nir: call nir_metadata_preserve at nir_remove_unused_io_vars

Without it we got a metadata assert:
deqp-vk: ../src/compiler/nir/nir_metadata.c:108: nir_metadata_check_validation_flag: Assertion `!(function->impl->valid_metadata & nir_metadata_not_properly_reset)' failed

if we try to use NIR_PASS(_, instead of NIR_PASS_V (that among other
things, do more validations).

Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17609>

---

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

diff --git a/src/compiler/nir/nir_linking_helpers.c b/src/compiler/nir/nir_linking_helpers.c
index 8304e820045..4a607b1c614 100644
--- a/src/compiler/nir/nir_linking_helpers.c
+++ b/src/compiler/nir/nir_linking_helpers.c
@@ -172,8 +172,14 @@ nir_remove_unused_io_vars(nir_shader *shader,
       }
    }
 
-   if (progress)
+   nir_function_impl *impl = nir_shader_get_entrypoint(shader);
+   if (progress) {
+      nir_metadata_preserve(impl, nir_metadata_dominance |
+                            nir_metadata_block_index);
       nir_fixup_deref_modes(shader);
+   } else {
+      nir_metadata_preserve(impl, nir_metadata_all);
+   }
 
    return progress;
 }



More information about the mesa-commit mailing list