Mesa (master): nir: Properly invalidate metadata in nir_remove_dead_variables().

Kenneth Graunke kwg at kemper.freedesktop.org
Wed Nov 4 01:11:07 UTC 2015


Module: Mesa
Branch: master
Commit: 4cb7546066f3f06b8030b8fce78f82469b0c6980
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4cb7546066f3f06b8030b8fce78f82469b0c6980

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Nov  2 21:28:26 2015 -0800

nir: Properly invalidate metadata in nir_remove_dead_variables().

v2: Preserve live_variables too (Jason).

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand at intel.com>
Reviewed-by: Eduardo Lima Mitev <elima at igalia.com>

---

 src/glsl/nir/nir_remove_dead_variables.c |   10 ++++++++--
 1 file changed, 8 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..530a847 100644
--- a/src/glsl/nir/nir_remove_dead_variables.c
+++ b/src/glsl/nir/nir_remove_dead_variables.c
@@ -126,8 +126,14 @@ 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 |
+                                                  nir_metadata_live_variables);
+            progress = true;
+         }
+      }
    }
 
    _mesa_set_destroy(live, NULL);




More information about the mesa-commit mailing list