nir: Free dead variables when removing them.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 27 Mar 2015 23:19:27 +0000 (16:19 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 2 Apr 2015 21:19:58 +0000 (14:19 -0700)
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
src/glsl/nir/nir_remove_dead_variables.c

index baa321e28db2a91cf0f473b221a799aa61daffe3..4417e2a48839008a6ca040365426284c1c00ca6e 100644 (file)
@@ -102,8 +102,10 @@ remove_dead_vars(struct exec_list *var_list, struct set *live)
 {
    foreach_list_typed_safe(nir_variable, var, node, var_list) {
       struct set_entry *entry = _mesa_set_search(live, var);
-      if (entry == NULL)
+      if (entry == NULL) {
          exec_node_remove(&var->node);
+         ralloc_free(var);
+      }
    }
 }