diff options
author | Connor Abbott <[email protected]> | 2015-07-21 19:54:23 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2015-08-24 13:31:42 -0700 |
commit | 788d45cb478d6285fe6811c87b4f1db1daded6d9 (patch) | |
tree | 8fea73b928d602a2aab1a878350b418015bd466d /src | |
parent | 747ddc3cdd51cc3786894e2ba56d86334a7051a5 (diff) |
nir/cf: handle phi nodes better in split_block_beginning()
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 | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_control_flow.c b/src/glsl/nir/nir_control_flow.c index 205b60819d4..b416a5813d3 100644 --- a/src/glsl/nir/nir_control_flow.c +++ b/src/glsl/nir/nir_control_flow.c @@ -210,6 +210,19 @@ split_block_beginning(nir_block *block) link_blocks(pred, new_block, NULL); } + /* Any phi nodes must stay part of the new block, or else their + * sourcse will be messed up. This will reverse the order of the phi's, but + * order shouldn't matter. + */ + nir_foreach_instr_safe(block, instr) { + if (instr->type != nir_instr_type_phi) + break; + + exec_node_remove(&instr->node); + instr->block = new_block; + exec_list_push_head(&new_block->instr_list, &instr->node); + } + return new_block; } |