[Mesa-dev] [PATCH 4/8] nir: Properly invalidate metadata in nir_remove_dead_variables().

Kenneth Graunke kenneth at whitecape.org
Tue Nov 3 00:31:18 PST 2015


We can't preserve dominance or live variable information.

This also begs the question: what about globals?  Metadata only exists
at the nir_function_impl level, so it would seem there is no metadata
about global variables for us to invalidate.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/glsl/nir/nir_remove_dead_variables.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/glsl/nir/nir_remove_dead_variables.c b/src/glsl/nir/nir_remove_dead_variables.c
index d6783e7..77b6c13 100644
--- a/src/glsl/nir/nir_remove_dead_variables.c
+++ b/src/glsl/nir/nir_remove_dead_variables.c
@@ -126,8 +126,13 @@ nir_remove_dead_variables(nir_shader *shader)
    progress = remove_dead_vars(&shader->globals, live) || progress;
 
    nir_foreach_overload(shader, overload) {
-      if (overload->impl)
-         progress = remove_dead_vars(&overload->impl->locals, live) || progress;
+      if (overload->impl) {
+         if (remove_dead_vars(&overload->impl->locals, live)) {
+            nir_metadata_preserve(overload->impl, nir_metadata_block_index |
+                                                  nir_metadata_dominance);
+            progress = true;
+         }
+      }
    }
 
    _mesa_set_destroy(live, NULL);
-- 
2.6.2



More information about the mesa-dev mailing list