diff options
author | Connor Abbott <[email protected]> | 2015-07-21 19:54:21 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2015-08-24 13:31:41 -0700 |
commit | 13482111d0dd9649d4b14ed05df344d5a2cea3de (patch) | |
tree | 53de7d05e7e5823455cbe7a358e4e93f8410477a /src/glsl/nir | |
parent | f41e108d8bdd360caedd1497dc676c928c7f18a3 (diff) |
nir/cf: add remove_phi_src() helper
Signed-off-by: Connor Abbott <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/nir')
-rw-r--r-- | src/glsl/nir/nir_control_flow.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_control_flow.c b/src/glsl/nir/nir_control_flow.c index bb94652757b..bf25813e8f1 100644 --- a/src/glsl/nir/nir_control_flow.c +++ b/src/glsl/nir/nir_control_flow.c @@ -373,6 +373,23 @@ nir_handle_add_jump(nir_block *block) } } +static void +remove_phi_src(nir_block *block, nir_block *pred) +{ + nir_foreach_instr(block, instr) { + if (instr->type != nir_instr_type_phi) + break; + + nir_phi_instr *phi = nir_instr_as_phi(instr); + nir_foreach_phi_src_safe(phi, src) { + if (src->pred == pred) { + list_del(&src->src.use_link); + exec_node_remove(&src->node); + } + } + } +} + void nir_handle_remove_jump(nir_block *block, nir_jump_type type) { |