diff options
author | Connor Abbott <cwabbott0@gmail.com> | 2016-04-12 15:14:04 -0400 |
---|---|---|
committer | Jason Ekstrand <jason.ekstrand@intel.com> | 2016-04-28 15:52:17 -0700 |
commit | db3517777254fe82413d3bf5b70a328a37222c8b (patch) | |
tree | ddcd5391f63ab823f9f1a624e026e03835560c6a | |
parent | b3aaae398ea97ecdfaed8a5640948572a8834c29 (diff) |
nir/remove_dead_variables: fixup for new foreach_block()
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
-rw-r--r-- | src/compiler/nir/nir_remove_dead_variables.c | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/src/compiler/nir/nir_remove_dead_variables.c b/src/compiler/nir/nir_remove_dead_variables.c index 22a286f041..c48fa40c07 100644 --- a/src/compiler/nir/nir_remove_dead_variables.c +++ b/src/compiler/nir/nir_remove_dead_variables.c @@ -65,39 +65,31 @@ add_var_use_tex(nir_tex_instr *instr, struct set *live) } } -static bool -add_var_use_block(nir_block *block, void *state) -{ - struct set *live = state; - - nir_foreach_instr(block, instr) { - switch(instr->type) { - case nir_instr_type_intrinsic: - add_var_use_intrinsic(nir_instr_as_intrinsic(instr), live); - break; - - case nir_instr_type_call: - add_var_use_call(nir_instr_as_call(instr), live); - break; - - case nir_instr_type_tex: - add_var_use_tex(nir_instr_as_tex(instr), live); - break; - - default: - break; - } - } - - return true; -} - static void add_var_use_shader(nir_shader *shader, struct set *live) { nir_foreach_function(shader, function) { if (function->impl) { - nir_foreach_block_call(function->impl, add_var_use_block, live); + nir_foreach_block(block, function->impl) { + nir_foreach_instr(block, instr) { + switch(instr->type) { + case nir_instr_type_intrinsic: + add_var_use_intrinsic(nir_instr_as_intrinsic(instr), live); + break; + + case nir_instr_type_call: + add_var_use_call(nir_instr_as_call(instr), live); + break; + + case nir_instr_type_tex: + add_var_use_tex(nir_instr_as_tex(instr), live); + break; + + default: + break; + } + } + } } } } |