aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/glsl/nir/nir_remove_dead_variables.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2015-04-20 22:42:55 +0200
committermarha <marha@users.sourceforge.net>2015-04-20 22:42:55 +0200
commit934184bfecd402aae891b8740d788b486aa7269f (patch)
treec23fb0afd169dc6846ea23bda21260fcffd1e3e6 /mesalib/src/glsl/nir/nir_remove_dead_variables.c
parent57dd848fb6dd7cf15820172e2abc9fb9de2b4268 (diff)
parent4ba9be2882d9f1567809edb0a31fcdf11320d41f (diff)
downloadvcxsrv-934184bfecd402aae891b8740d788b486aa7269f.tar.gz
vcxsrv-934184bfecd402aae891b8740d788b486aa7269f.tar.bz2
vcxsrv-934184bfecd402aae891b8740d788b486aa7269f.zip
Merge remote-tracking branch 'origin/released'
Conflicts: mesalib/src/mesa/main/.gitignore mesalib/src/mesa/main/dlopen.h xorg-server/hw/xwin/glx/gen_gl_wrappers.py xorg-server/hw/xwin/win.h xorg-server/hw/xwin/winengine.c xorg-server/hw/xwin/winglobals.c xorg-server/hw/xwin/winscrinit.c xorg-server/hw/xwin/winshaddd.c xorg-server/randr/rrxinerama.c
Diffstat (limited to 'mesalib/src/glsl/nir/nir_remove_dead_variables.c')
-rw-r--r--mesalib/src/glsl/nir/nir_remove_dead_variables.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/mesalib/src/glsl/nir/nir_remove_dead_variables.c b/mesalib/src/glsl/nir/nir_remove_dead_variables.c
index e7f8aeacb..4417e2a48 100644
--- a/mesalib/src/glsl/nir/nir_remove_dead_variables.c
+++ b/mesalib/src/glsl/nir/nir_remove_dead_variables.c
@@ -98,22 +98,14 @@ add_var_use_shader(nir_shader *shader, struct set *live)
}
static void
-remove_dead_local_vars(nir_function_impl *impl, struct set *live)
+remove_dead_vars(struct exec_list *var_list, struct set *live)
{
- foreach_list_typed_safe(nir_variable, var, node, &impl->locals) {
+ foreach_list_typed_safe(nir_variable, var, node, var_list) {
struct set_entry *entry = _mesa_set_search(live, var);
- if (entry == NULL)
- exec_node_remove(&var->node);
- }
-}
-
-static void
-remove_dead_global_vars(nir_shader *shader, struct set *live)
-{
- foreach_list_typed_safe(nir_variable, var, node, &shader->globals) {
- struct set_entry *entry = _mesa_set_search(live, var);
- if (entry == NULL)
+ if (entry == NULL) {
exec_node_remove(&var->node);
+ ralloc_free(var);
+ }
}
}
@@ -125,11 +117,11 @@ nir_remove_dead_variables(nir_shader *shader)
add_var_use_shader(shader, live);
- remove_dead_global_vars(shader, live);
+ remove_dead_vars(&shader->globals, live);
nir_foreach_overload(shader, overload) {
if (overload->impl)
- remove_dead_local_vars(overload->impl, live);
+ remove_dead_vars(&overload->impl->locals, live);
}
_mesa_set_destroy(live, NULL);