diff options
author | Connor Abbott <[email protected]> | 2015-07-21 19:54:28 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2015-08-24 13:31:42 -0700 |
commit | 6d028749ac593b6c724ab86a42bf969da47cc569 (patch) | |
tree | 8a5afb250715d8369a8baab676b10e1066c21ae8 /src | |
parent | 211c79515d2d4cde12cc6a19bb064692b2de3f26 (diff) |
nir/cf: clean up jumps when cleaning up CF nodes
We may delete a control flow node which contains structured jumps to
other parts of the program. We need to remove the jump as a predecessor,
as well as remove any phi node sources which reference it. Right now,
the same problem exists for blocks that don't end in a jump instruction,
but with the new API it shouldn't be an issue, since blocks that don't
end in a jump must either point to another block in the same extracted
CF list or not point to anything at all.
Signed-off-by: Connor Abbott <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/glsl/nir/nir_control_flow.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/glsl/nir/nir_control_flow.c b/src/glsl/nir/nir_control_flow.c index 5aab43bbf77..91788adb85f 100644 --- a/src/glsl/nir/nir_control_flow.c +++ b/src/glsl/nir/nir_control_flow.c @@ -747,7 +747,10 @@ cleanup_cf_node(nir_cf_node *node, nir_function_impl *impl) nir_block *block = nir_cf_node_as_block(node); /* We need to walk the instructions and clean up defs/uses */ nir_foreach_instr_safe(block, instr) { - if (instr->type != nir_instr_type_jump) { + if (instr->type == nir_instr_type_jump) { + nir_jump_type jump_type = nir_instr_as_jump(instr)->type; + unlink_jump(block, jump_type); + } else { nir_foreach_ssa_def(instr, replace_ssa_def_uses, impl); nir_instr_remove(instr); } |