[Mesa-dev] [PATCH 26/47] nir/lower_var_copies: fixup for new foreach_block()
Connor Abbott
cwabbott0 at gmail.com
Wed Apr 13 04:35:05 UTC 2016
Signed-off-by: Connor Abbott <cwabbott0 at gmail.com>
---
src/compiler/nir/nir_lower_var_copies.c | 34 +++++++++++++++------------------
1 file changed, 15 insertions(+), 19 deletions(-)
diff --git a/src/compiler/nir/nir_lower_var_copies.c b/src/compiler/nir/nir_lower_var_copies.c
index c994f0f..4feb54b 100644
--- a/src/compiler/nir/nir_lower_var_copies.c
+++ b/src/compiler/nir/nir_lower_var_copies.c
@@ -154,30 +154,26 @@ nir_lower_var_copy_instr(nir_intrinsic_instr *copy, void *mem_ctx)
©->variables[1]->deref, mem_ctx);
}
-static bool
-lower_var_copies_block(nir_block *block, void *mem_ctx)
+static void
+lower_var_copies_impl(nir_function_impl *impl)
{
- nir_foreach_instr_safe(block, instr) {
- if (instr->type != nir_instr_type_intrinsic)
- continue;
+ void *mem_ctx = ralloc_parent(impl);
- nir_intrinsic_instr *copy = nir_instr_as_intrinsic(instr);
- if (copy->intrinsic != nir_intrinsic_copy_var)
- continue;
-
- nir_lower_var_copy_instr(copy, mem_ctx);
+ nir_foreach_block(impl, block) {
+ nir_foreach_instr_safe(block, instr) {
+ if (instr->type != nir_instr_type_intrinsic)
+ continue;
- nir_instr_remove(©->instr);
- ralloc_free(copy);
- }
+ nir_intrinsic_instr *copy = nir_instr_as_intrinsic(instr);
+ if (copy->intrinsic != nir_intrinsic_copy_var)
+ continue;
- return true;
-}
+ nir_lower_var_copy_instr(copy, mem_ctx);
-static void
-lower_var_copies_impl(nir_function_impl *impl)
-{
- nir_foreach_block(impl, lower_var_copies_block, ralloc_parent(impl));
+ nir_instr_remove(©->instr);
+ ralloc_free(copy);
+ }
+ }
}
/* Lowers every copy_var instruction in the program to a sequence of
--
2.5.0
More information about the mesa-dev
mailing list