2 * Copyright © 2014 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 * Connor Abbott (cwabbott0@gmail.com)
28 #include "nir_control_flow_private.h"
31 * \name Control flow modification
33 * These functions modify the control flow tree while keeping the control flow
34 * graph up-to-date. The invariants respected are:
35 * 1. Each then statement, else statement, or loop body must have at least one
37 * 2. Each if-statement and loop must have one basic block before it and one
39 * 3. Two basic blocks cannot be directly next to each other.
40 * 4. If a basic block has a jump instruction, there must be only one and it
41 * must be at the end of the block.
43 * The purpose of the second one is so that we have places to insert code during
44 * GCM, as well as eliminating the possibility of critical edges.
49 block_ends_in_jump(nir_block
*block
)
51 return !exec_list_is_empty(&block
->instr_list
) &&
52 nir_block_last_instr(block
)->type
== nir_instr_type_jump
;
56 block_add_pred(nir_block
*block
, nir_block
*pred
)
58 _mesa_set_add(block
->predecessors
, pred
);
62 block_remove_pred(nir_block
*block
, nir_block
*pred
)
64 struct set_entry
*entry
= _mesa_set_search(block
->predecessors
, pred
);
68 _mesa_set_remove(block
->predecessors
, entry
);
72 link_blocks(nir_block
*pred
, nir_block
*succ1
, nir_block
*succ2
)
74 pred
->successors
[0] = succ1
;
76 block_add_pred(succ1
, pred
);
78 pred
->successors
[1] = succ2
;
80 block_add_pred(succ2
, pred
);
84 unlink_blocks(nir_block
*pred
, nir_block
*succ
)
86 if (pred
->successors
[0] == succ
) {
87 pred
->successors
[0] = pred
->successors
[1];
88 pred
->successors
[1] = NULL
;
90 assert(pred
->successors
[1] == succ
);
91 pred
->successors
[1] = NULL
;
94 block_remove_pred(succ
, pred
);
98 unlink_block_successors(nir_block
*block
)
100 if (block
->successors
[1] != NULL
)
101 unlink_blocks(block
, block
->successors
[1]);
102 if (block
->successors
[0] != NULL
)
103 unlink_blocks(block
, block
->successors
[0]);
107 link_non_block_to_block(nir_cf_node
*node
, nir_block
*block
)
109 if (node
->type
== nir_cf_node_if
) {
111 * We're trying to link an if to a block after it; this just means linking
112 * the last block of the then and else branches.
115 nir_if
*if_stmt
= nir_cf_node_as_if(node
);
117 nir_cf_node
*last_then
= nir_if_last_then_node(if_stmt
);
118 assert(last_then
->type
== nir_cf_node_block
);
119 nir_block
*last_then_block
= nir_cf_node_as_block(last_then
);
121 nir_cf_node
*last_else
= nir_if_last_else_node(if_stmt
);
122 assert(last_else
->type
== nir_cf_node_block
);
123 nir_block
*last_else_block
= nir_cf_node_as_block(last_else
);
125 if (!block_ends_in_jump(last_then_block
)) {
126 unlink_block_successors(last_then_block
);
127 link_blocks(last_then_block
, block
, NULL
);
130 if (!block_ends_in_jump(last_else_block
)) {
131 unlink_block_successors(last_else_block
);
132 link_blocks(last_else_block
, block
, NULL
);
135 assert(node
->type
== nir_cf_node_loop
);
140 link_block_to_non_block(nir_block
*block
, nir_cf_node
*node
)
142 if (node
->type
== nir_cf_node_if
) {
144 * We're trying to link a block to an if after it; this just means linking
145 * the block to the first block of the then and else branches.
148 nir_if
*if_stmt
= nir_cf_node_as_if(node
);
150 nir_cf_node
*first_then
= nir_if_first_then_node(if_stmt
);
151 assert(first_then
->type
== nir_cf_node_block
);
152 nir_block
*first_then_block
= nir_cf_node_as_block(first_then
);
154 nir_cf_node
*first_else
= nir_if_first_else_node(if_stmt
);
155 assert(first_else
->type
== nir_cf_node_block
);
156 nir_block
*first_else_block
= nir_cf_node_as_block(first_else
);
158 unlink_block_successors(block
);
159 link_blocks(block
, first_then_block
, first_else_block
);
162 * For similar reasons as the corresponding case in
163 * link_non_block_to_block(), don't worry about if the loop header has
164 * any predecessors that need to be unlinked.
167 assert(node
->type
== nir_cf_node_loop
);
169 nir_loop
*loop
= nir_cf_node_as_loop(node
);
171 nir_cf_node
*loop_header
= nir_loop_first_cf_node(loop
);
172 assert(loop_header
->type
== nir_cf_node_block
);
173 nir_block
*loop_header_block
= nir_cf_node_as_block(loop_header
);
175 unlink_block_successors(block
);
176 link_blocks(block
, loop_header_block
, NULL
);
182 * Replace a block's successor with a different one.
185 replace_successor(nir_block
*block
, nir_block
*old_succ
, nir_block
*new_succ
)
187 if (block
->successors
[0] == old_succ
) {
188 block
->successors
[0] = new_succ
;
190 assert(block
->successors
[1] == old_succ
);
191 block
->successors
[1] = new_succ
;
194 block_remove_pred(old_succ
, block
);
195 block_add_pred(new_succ
, block
);
199 * Takes a basic block and inserts a new empty basic block before it, making its
200 * predecessors point to the new block. This essentially splits the block into
201 * an empty header and a body so that another non-block CF node can be inserted
202 * between the two. Note that this does *not* link the two basic blocks, so
203 * some kind of cleanup *must* be performed after this call.
207 split_block_beginning(nir_block
*block
)
209 nir_block
*new_block
= nir_block_create(ralloc_parent(block
));
210 new_block
->cf_node
.parent
= block
->cf_node
.parent
;
211 exec_node_insert_node_before(&block
->cf_node
.node
, &new_block
->cf_node
.node
);
213 struct set_entry
*entry
;
214 set_foreach(block
->predecessors
, entry
) {
215 nir_block
*pred
= (nir_block
*) entry
->key
;
216 replace_successor(pred
, block
, new_block
);
219 /* Any phi nodes must stay part of the new block, or else their
220 * sourcse will be messed up. This will reverse the order of the phi's, but
221 * order shouldn't matter.
223 nir_foreach_instr_safe(instr
, block
) {
224 if (instr
->type
!= nir_instr_type_phi
)
227 exec_node_remove(&instr
->node
);
228 instr
->block
= new_block
;
229 exec_list_push_head(&new_block
->instr_list
, &instr
->node
);
236 rewrite_phi_preds(nir_block
*block
, nir_block
*old_pred
, nir_block
*new_pred
)
238 nir_foreach_instr_safe(instr
, block
) {
239 if (instr
->type
!= nir_instr_type_phi
)
242 nir_phi_instr
*phi
= nir_instr_as_phi(instr
);
243 nir_foreach_phi_src(src
, phi
) {
244 if (src
->pred
== old_pred
) {
245 src
->pred
= new_pred
;
253 insert_phi_undef(nir_block
*block
, nir_block
*pred
)
255 nir_function_impl
*impl
= nir_cf_node_get_function(&block
->cf_node
);
256 nir_foreach_instr(instr
, block
) {
257 if (instr
->type
!= nir_instr_type_phi
)
260 nir_phi_instr
*phi
= nir_instr_as_phi(instr
);
261 nir_ssa_undef_instr
*undef
=
262 nir_ssa_undef_instr_create(ralloc_parent(phi
),
263 phi
->dest
.ssa
.num_components
,
264 phi
->dest
.ssa
.bit_size
);
265 nir_instr_insert_before_cf_list(&impl
->body
, &undef
->instr
);
266 nir_phi_src
*src
= ralloc(phi
, nir_phi_src
);
268 src
->src
.parent_instr
= &phi
->instr
;
269 src
->src
.is_ssa
= true;
270 src
->src
.ssa
= &undef
->def
;
272 list_addtail(&src
->src
.use_link
, &undef
->def
.uses
);
274 exec_list_push_tail(&phi
->srcs
, &src
->node
);
279 * Moves the successors of source to the successors of dest, leaving both
280 * successors of source NULL.
284 move_successors(nir_block
*source
, nir_block
*dest
)
286 nir_block
*succ1
= source
->successors
[0];
287 nir_block
*succ2
= source
->successors
[1];
290 unlink_blocks(source
, succ1
);
291 rewrite_phi_preds(succ1
, source
, dest
);
295 unlink_blocks(source
, succ2
);
296 rewrite_phi_preds(succ2
, source
, dest
);
299 unlink_block_successors(dest
);
300 link_blocks(dest
, succ1
, succ2
);
303 /* Given a basic block with no successors that has been inserted into the
304 * control flow tree, gives it the successors it would normally have assuming
305 * it doesn't end in a jump instruction. Also inserts phi sources with undefs
309 block_add_normal_succs(nir_block
*block
)
311 if (exec_node_is_tail_sentinel(block
->cf_node
.node
.next
)) {
312 nir_cf_node
*parent
= block
->cf_node
.parent
;
313 if (parent
->type
== nir_cf_node_if
) {
314 nir_cf_node
*next
= nir_cf_node_next(parent
);
315 assert(next
->type
== nir_cf_node_block
);
316 nir_block
*next_block
= nir_cf_node_as_block(next
);
318 link_blocks(block
, next_block
, NULL
);
319 } else if (parent
->type
== nir_cf_node_loop
) {
320 nir_loop
*loop
= nir_cf_node_as_loop(parent
);
322 nir_cf_node
*head
= nir_loop_first_cf_node(loop
);
323 assert(head
->type
== nir_cf_node_block
);
324 nir_block
*head_block
= nir_cf_node_as_block(head
);
326 link_blocks(block
, head_block
, NULL
);
327 insert_phi_undef(head_block
, block
);
329 assert(parent
->type
== nir_cf_node_function
);
330 nir_function_impl
*impl
= nir_cf_node_as_function(parent
);
331 link_blocks(block
, impl
->end_block
, NULL
);
334 nir_cf_node
*next
= nir_cf_node_next(&block
->cf_node
);
335 if (next
->type
== nir_cf_node_if
) {
336 nir_if
*next_if
= nir_cf_node_as_if(next
);
338 nir_cf_node
*first_then
= nir_if_first_then_node(next_if
);
339 assert(first_then
->type
== nir_cf_node_block
);
340 nir_block
*first_then_block
= nir_cf_node_as_block(first_then
);
342 nir_cf_node
*first_else
= nir_if_first_else_node(next_if
);
343 assert(first_else
->type
== nir_cf_node_block
);
344 nir_block
*first_else_block
= nir_cf_node_as_block(first_else
);
346 link_blocks(block
, first_then_block
, first_else_block
);
348 assert(next
->type
== nir_cf_node_loop
);
349 nir_loop
*next_loop
= nir_cf_node_as_loop(next
);
351 nir_cf_node
*first
= nir_loop_first_cf_node(next_loop
);
352 assert(first
->type
== nir_cf_node_block
);
353 nir_block
*first_block
= nir_cf_node_as_block(first
);
355 link_blocks(block
, first_block
, NULL
);
356 insert_phi_undef(first_block
, block
);
362 split_block_end(nir_block
*block
)
364 nir_block
*new_block
= nir_block_create(ralloc_parent(block
));
365 new_block
->cf_node
.parent
= block
->cf_node
.parent
;
366 exec_node_insert_after(&block
->cf_node
.node
, &new_block
->cf_node
.node
);
368 if (block_ends_in_jump(block
)) {
369 /* Figure out what successor block would've had if it didn't have a jump
370 * instruction, and make new_block have that successor.
372 block_add_normal_succs(new_block
);
374 move_successors(block
, new_block
);
381 split_block_before_instr(nir_instr
*instr
)
383 assert(instr
->type
!= nir_instr_type_phi
);
384 nir_block
*new_block
= split_block_beginning(instr
->block
);
386 nir_foreach_instr_safe(cur_instr
, instr
->block
) {
387 if (cur_instr
== instr
)
390 exec_node_remove(&cur_instr
->node
);
391 cur_instr
->block
= new_block
;
392 exec_list_push_tail(&new_block
->instr_list
, &cur_instr
->node
);
398 /* Splits a basic block at the point specified by the cursor. The "before" and
399 * "after" arguments are filled out with the blocks resulting from the split
400 * if non-NULL. Note that the "beginning" of the block is actually interpreted
401 * as before the first non-phi instruction, and it's illegal to split a block
402 * before a phi instruction.
406 split_block_cursor(nir_cursor cursor
,
407 nir_block
**_before
, nir_block
**_after
)
409 nir_block
*before
, *after
;
410 switch (cursor
.option
) {
411 case nir_cursor_before_block
:
412 after
= cursor
.block
;
413 before
= split_block_beginning(cursor
.block
);
416 case nir_cursor_after_block
:
417 before
= cursor
.block
;
418 after
= split_block_end(cursor
.block
);
421 case nir_cursor_before_instr
:
422 after
= cursor
.instr
->block
;
423 before
= split_block_before_instr(cursor
.instr
);
426 case nir_cursor_after_instr
:
427 /* We lower this to split_block_before_instr() so that we can keep the
428 * after-a-jump-instr case contained to split_block_end().
430 if (nir_instr_is_last(cursor
.instr
)) {
431 before
= cursor
.instr
->block
;
432 after
= split_block_end(cursor
.instr
->block
);
434 after
= cursor
.instr
->block
;
435 before
= split_block_before_instr(nir_instr_next(cursor
.instr
));
440 unreachable("not reached");
450 * Inserts a non-basic block between two basic blocks and links them together.
454 insert_non_block(nir_block
*before
, nir_cf_node
*node
, nir_block
*after
)
456 node
->parent
= before
->cf_node
.parent
;
457 exec_node_insert_after(&before
->cf_node
.node
, &node
->node
);
458 link_block_to_non_block(before
, node
);
459 link_non_block_to_block(node
, after
);
462 /* walk up the control flow tree to find the innermost enclosed loop */
464 nearest_loop(nir_cf_node
*node
)
466 while (node
->type
!= nir_cf_node_loop
) {
470 return nir_cf_node_as_loop(node
);
474 * update the CFG after a jump instruction has been added to the end of a block
478 nir_handle_add_jump(nir_block
*block
)
480 nir_instr
*instr
= nir_block_last_instr(block
);
481 nir_jump_instr
*jump_instr
= nir_instr_as_jump(instr
);
483 unlink_block_successors(block
);
485 nir_function_impl
*impl
= nir_cf_node_get_function(&block
->cf_node
);
486 nir_metadata_preserve(impl
, nir_metadata_none
);
488 if (jump_instr
->type
== nir_jump_break
||
489 jump_instr
->type
== nir_jump_continue
) {
490 nir_loop
*loop
= nearest_loop(&block
->cf_node
);
492 if (jump_instr
->type
== nir_jump_continue
) {
493 nir_cf_node
*first_node
= nir_loop_first_cf_node(loop
);
494 assert(first_node
->type
== nir_cf_node_block
);
495 nir_block
*first_block
= nir_cf_node_as_block(first_node
);
496 link_blocks(block
, first_block
, NULL
);
498 nir_cf_node
*after
= nir_cf_node_next(&loop
->cf_node
);
499 assert(after
->type
== nir_cf_node_block
);
500 nir_block
*after_block
= nir_cf_node_as_block(after
);
501 link_blocks(block
, after_block
, NULL
);
504 assert(jump_instr
->type
== nir_jump_return
);
505 link_blocks(block
, impl
->end_block
, NULL
);
510 remove_phi_src(nir_block
*block
, nir_block
*pred
)
512 nir_foreach_instr(instr
, block
) {
513 if (instr
->type
!= nir_instr_type_phi
)
516 nir_phi_instr
*phi
= nir_instr_as_phi(instr
);
517 nir_foreach_phi_src_safe(src
, phi
) {
518 if (src
->pred
== pred
) {
519 list_del(&src
->src
.use_link
);
520 exec_node_remove(&src
->node
);
526 /* Removes the successor of a block with a jump. Note that the jump to be
527 * eliminated may be free-floating.
531 unlink_jump(nir_block
*block
, nir_jump_type type
, bool add_normal_successors
)
533 nir_block
*next
= block
->successors
[0];
535 if (block
->successors
[0])
536 remove_phi_src(block
->successors
[0], block
);
537 if (block
->successors
[1])
538 remove_phi_src(block
->successors
[1], block
);
540 unlink_block_successors(block
);
541 if (add_normal_successors
)
542 block_add_normal_succs(block
);
546 nir_handle_remove_jump(nir_block
*block
, nir_jump_type type
)
548 unlink_jump(block
, type
, true);
550 nir_function_impl
*impl
= nir_cf_node_get_function(&block
->cf_node
);
551 nir_metadata_preserve(impl
, nir_metadata_none
);
555 update_if_uses(nir_cf_node
*node
)
557 if (node
->type
!= nir_cf_node_if
)
560 nir_if
*if_stmt
= nir_cf_node_as_if(node
);
562 if_stmt
->condition
.parent_if
= if_stmt
;
563 if (if_stmt
->condition
.is_ssa
) {
564 list_addtail(&if_stmt
->condition
.use_link
,
565 &if_stmt
->condition
.ssa
->if_uses
);
567 list_addtail(&if_stmt
->condition
.use_link
,
568 &if_stmt
->condition
.reg
.reg
->if_uses
);
573 * Stitch two basic blocks together into one. The aggregate must have the same
574 * predecessors as the first and the same successors as the second.
578 stitch_blocks(nir_block
*before
, nir_block
*after
)
581 * We move after into before, so we have to deal with up to 2 successors vs.
582 * possibly a large number of predecessors.
584 * TODO: special case when before is empty and after isn't?
587 if (block_ends_in_jump(before
)) {
588 assert(exec_list_is_empty(&after
->instr_list
));
589 if (after
->successors
[0])
590 remove_phi_src(after
->successors
[0], after
);
591 if (after
->successors
[1])
592 remove_phi_src(after
->successors
[1], after
);
593 unlink_block_successors(after
);
594 exec_node_remove(&after
->cf_node
.node
);
596 move_successors(after
, before
);
598 foreach_list_typed(nir_instr
, instr
, node
, &after
->instr_list
) {
599 instr
->block
= before
;
602 exec_list_append(&before
->instr_list
, &after
->instr_list
);
603 exec_node_remove(&after
->cf_node
.node
);
608 nir_cf_node_insert(nir_cursor cursor
, nir_cf_node
*node
)
610 nir_block
*before
, *after
;
612 split_block_cursor(cursor
, &before
, &after
);
614 if (node
->type
== nir_cf_node_block
) {
615 nir_block
*block
= nir_cf_node_as_block(node
);
616 exec_node_insert_after(&before
->cf_node
.node
, &block
->cf_node
.node
);
617 block
->cf_node
.parent
= before
->cf_node
.parent
;
618 /* stitch_blocks() assumes that any block that ends with a jump has
619 * already been setup with the correct successors, so we need to set
620 * up jumps here as the block is being inserted.
622 if (block_ends_in_jump(block
))
623 nir_handle_add_jump(block
);
625 stitch_blocks(block
, after
);
626 stitch_blocks(before
, block
);
628 update_if_uses(node
);
629 insert_non_block(before
, node
, after
);
634 replace_ssa_def_uses(nir_ssa_def
*def
, void *void_impl
)
636 nir_function_impl
*impl
= void_impl
;
637 void *mem_ctx
= ralloc_parent(impl
);
639 nir_ssa_undef_instr
*undef
=
640 nir_ssa_undef_instr_create(mem_ctx
, def
->num_components
,
642 nir_instr_insert_before_cf_list(&impl
->body
, &undef
->instr
);
643 nir_ssa_def_rewrite_uses(def
, nir_src_for_ssa(&undef
->def
));
648 cleanup_cf_node(nir_cf_node
*node
, nir_function_impl
*impl
)
650 switch (node
->type
) {
651 case nir_cf_node_block
: {
652 nir_block
*block
= nir_cf_node_as_block(node
);
653 /* We need to walk the instructions and clean up defs/uses */
654 nir_foreach_instr_safe(instr
, block
) {
655 if (instr
->type
== nir_instr_type_jump
) {
656 nir_jump_type jump_type
= nir_instr_as_jump(instr
)->type
;
657 unlink_jump(block
, jump_type
, false);
659 nir_foreach_ssa_def(instr
, replace_ssa_def_uses
, impl
);
660 nir_instr_remove(instr
);
666 case nir_cf_node_if
: {
667 nir_if
*if_stmt
= nir_cf_node_as_if(node
);
668 foreach_list_typed(nir_cf_node
, child
, node
, &if_stmt
->then_list
)
669 cleanup_cf_node(child
, impl
);
670 foreach_list_typed(nir_cf_node
, child
, node
, &if_stmt
->else_list
)
671 cleanup_cf_node(child
, impl
);
673 list_del(&if_stmt
->condition
.use_link
);
677 case nir_cf_node_loop
: {
678 nir_loop
*loop
= nir_cf_node_as_loop(node
);
679 foreach_list_typed(nir_cf_node
, child
, node
, &loop
->body
)
680 cleanup_cf_node(child
, impl
);
683 case nir_cf_node_function
: {
684 nir_function_impl
*impl
= nir_cf_node_as_function(node
);
685 foreach_list_typed(nir_cf_node
, child
, node
, &impl
->body
)
686 cleanup_cf_node(child
, impl
);
690 unreachable("Invalid CF node type");
695 nir_cf_extract(nir_cf_list
*extracted
, nir_cursor begin
, nir_cursor end
)
697 nir_block
*block_begin
, *block_end
, *block_before
, *block_after
;
699 if (nir_cursors_equal(begin
, end
)) {
700 exec_list_make_empty(&extracted
->list
);
701 extracted
->impl
= NULL
; /* we shouldn't need this */
705 /* In the case where begin points to an instruction in some basic block and
706 * end points to the end of the same basic block, we rely on the fact that
707 * splitting on an instruction moves earlier instructions into a new basic
708 * block. If the later instructions were moved instead, then the end cursor
709 * would be pointing to the same place that begin used to point to, which
710 * is obviously not what we want.
712 split_block_cursor(begin
, &block_before
, &block_begin
);
713 split_block_cursor(end
, &block_end
, &block_after
);
715 extracted
->impl
= nir_cf_node_get_function(&block_begin
->cf_node
);
716 exec_list_make_empty(&extracted
->list
);
718 /* Dominance and other block-related information is toast. */
719 nir_metadata_preserve(extracted
->impl
, nir_metadata_none
);
721 nir_cf_node
*cf_node
= &block_begin
->cf_node
;
722 nir_cf_node
*cf_node_end
= &block_end
->cf_node
;
724 nir_cf_node
*next
= nir_cf_node_next(cf_node
);
726 exec_node_remove(&cf_node
->node
);
727 cf_node
->parent
= NULL
;
728 exec_list_push_tail(&extracted
->list
, &cf_node
->node
);
730 if (cf_node
== cf_node_end
)
736 stitch_blocks(block_before
, block_after
);
740 nir_cf_reinsert(nir_cf_list
*cf_list
, nir_cursor cursor
)
742 nir_block
*before
, *after
;
744 if (exec_list_is_empty(&cf_list
->list
))
747 split_block_cursor(cursor
, &before
, &after
);
749 foreach_list_typed_safe(nir_cf_node
, node
, node
, &cf_list
->list
) {
750 exec_node_remove(&node
->node
);
751 node
->parent
= before
->cf_node
.parent
;
752 exec_node_insert_node_before(&after
->cf_node
.node
, &node
->node
);
755 stitch_blocks(before
,
756 nir_cf_node_as_block(nir_cf_node_next(&before
->cf_node
)));
757 stitch_blocks(nir_cf_node_as_block(nir_cf_node_prev(&after
->cf_node
)),
762 nir_cf_delete(nir_cf_list
*cf_list
)
764 foreach_list_typed(nir_cf_node
, node
, node
, &cf_list
->list
) {
765 cleanup_cf_node(node
, cf_list
->impl
);