diff options
author | Jason Ekstrand <[email protected]> | 2016-12-24 10:58:17 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-12-30 12:38:04 -0800 |
commit | ffa4ba71d91396f7323affedb21618d183a28443 (patch) | |
tree | 4f13f2a76b724244bea2e21af7c6f39e93190cd9 /src/compiler | |
parent | cd6f736c0702da3e620d9c97a1a01d911d72381f (diff) |
nir/opt_peephole_select: Pass around the actual nir_shader
Reviewed-by: Eduardo Lima Mitev <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/nir/nir_opt_peephole_select.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/compiler/nir/nir_opt_peephole_select.c b/src/compiler/nir/nir_opt_peephole_select.c index 9c85c178ac7..87a8ee0fb0e 100644 --- a/src/compiler/nir/nir_opt_peephole_select.c +++ b/src/compiler/nir/nir_opt_peephole_select.c @@ -147,7 +147,8 @@ block_check_for_allowed_instrs(nir_block *block, unsigned *count, bool alu_ok) } static bool -nir_opt_peephole_select_block(nir_block *block, void *mem_ctx, unsigned limit) +nir_opt_peephole_select_block(nir_block *block, nir_shader *shader, + unsigned limit) { if (nir_cf_node_is_first(&block->cf_node)) return false; @@ -203,7 +204,7 @@ nir_opt_peephole_select_block(nir_block *block, void *mem_ctx, unsigned limit) break; nir_phi_instr *phi = nir_instr_as_phi(instr); - nir_alu_instr *sel = nir_alu_instr_create(mem_ctx, nir_op_bcsel); + nir_alu_instr *sel = nir_alu_instr_create(shader, nir_op_bcsel); nir_src_copy(&sel->src[0].src, &if_stmt->condition, sel); /* Splat the condition to all channels */ memset(sel->src[0].swizzle, 0, sizeof sel->src[0].swizzle); @@ -236,11 +237,11 @@ nir_opt_peephole_select_block(nir_block *block, void *mem_ctx, unsigned limit) static bool nir_opt_peephole_select_impl(nir_function_impl *impl, unsigned limit) { - void *mem_ctx = ralloc_parent(impl); + nir_shader *shader = impl->function->shader; bool progress = false; nir_foreach_block_safe(block, impl) { - progress |= nir_opt_peephole_select_block(block, mem_ctx, limit); + progress |= nir_opt_peephole_select_block(block, shader, limit); } if (progress) |