mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 04:38:03 +02:00
nir/control_flow: Handle relinking top-level blocks
This can happen if a function ends in a return instruction and you remove the return.
This commit is contained in:
parent
1749e667ea
commit
86772c2488
1 changed files with 5 additions and 2 deletions
|
|
@ -336,8 +336,7 @@ block_add_normal_succs(nir_block *block)
|
|||
nir_block *next_block = nir_cf_node_as_block(next);
|
||||
|
||||
link_blocks(block, next_block, NULL);
|
||||
} else {
|
||||
assert(parent->type == nir_cf_node_loop);
|
||||
} else if (parent->type == nir_cf_node_loop) {
|
||||
nir_loop *loop = nir_cf_node_as_loop(parent);
|
||||
|
||||
nir_cf_node *head = nir_loop_first_cf_node(loop);
|
||||
|
|
@ -346,6 +345,10 @@ block_add_normal_succs(nir_block *block)
|
|||
|
||||
link_blocks(block, head_block, NULL);
|
||||
insert_phi_undef(head_block, block);
|
||||
} else {
|
||||
assert(parent->type == nir_cf_node_function);
|
||||
nir_function_impl *impl = nir_cf_node_as_function(parent);
|
||||
link_blocks(block, impl->end_block, NULL);
|
||||
}
|
||||
} else {
|
||||
nir_cf_node *next = nir_cf_node_next(&block->cf_node);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue