nir: Properly invalidate metadata in nir_remove_dead_variables().
authorKenneth Graunke <kenneth@whitecape.org>
Tue, 3 Nov 2015 05:28:26 +0000 (21:28 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 4 Nov 2015 01:06:48 +0000 (17:06 -0800)
v2: Preserve live_variables too (Jason).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
src/glsl/nir/nir_remove_dead_variables.c

index d6783e788033ac3154b9e1489f4f2c1c1ce13de4..530a8475ed5b46cf8c98c17f75cfad64bb30ccf0 100644 (file)
@@ -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);