new_block->cf_node.parent = block->cf_node.parent;
exec_node_insert_node_before(&block->cf_node.node, &new_block->cf_node.node);
- struct set_entry *entry;
set_foreach(block->predecessors, entry) {
nir_block *pred = (nir_block *) entry->key;
replace_successor(pred, block, new_block);
}
/* 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 phis, but
- * order shouldn't matter.
+ * sources will be messed up.
*/
nir_foreach_instr_safe(instr, block) {
if (instr->type != nir_instr_type_phi)
exec_node_remove(&instr->node);
instr->block = new_block;
- exec_list_push_head(&new_block->instr_list, &instr->node);
+ exec_list_push_tail(&new_block->instr_list, &instr->node);
}
return new_block;