nir/cf: handle phi nodes better in split_block_beginning()

Signed-off-by: Connor Abbott <connor.w.abbott@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Connor Abbott 2015-07-21 19:54:23 -07:00 committed by Kenneth Graunke
parent 747ddc3cdd
commit 788d45cb47
1 changed files with 13 additions and 0 deletions

View File

@ -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;
}