Lines Matching defs:loop

35  * Gets the single block that jumps back to the loop header. Already assumes
39 find_continue_block(nir_loop *loop)
41 nir_block *header_block = nir_loop_first_block(loop);
43 nir_cf_node_as_block(nir_cf_node_prev(&loop->cf_node));
56 * Does a phi have one constant value from outside a loop and one from inside?
87 * the loop and the other half of the if to the end of the loop. A simple for
88 * loop "for (int i = 0; i < 4; i++)", when run through the SPIR-V front-end,
93 * loop {
120 * loop {
139 opt_peel_loop_initial_if(nir_loop *loop)
141 nir_block *header_block = nir_loop_first_block(loop);
143 nir_cf_node_as_block(nir_cf_node_prev(&loop->cf_node));
148 /* The loop must have exactly one continue block which could be a block
150 * last block in the loop back to the top.
193 /* We want to be moving the contents of entry_list to above the loop so it
209 nir_cf_node_get_function(&loop->cf_node));
211 /* Before we do anything, convert the loop to LCSSA. We're about to
213 * it from leaking outside the loop.
215 nir_convert_loop_to_lcssa(loop);
234 nir_cf_list_clone(&tmp, &header, &loop->cf_node, NULL);
235 nir_cf_reinsert(&tmp, nir_before_cf_node(&loop->cf_node));
238 nir_cf_reinsert(&tmp, nir_before_cf_node(&loop->cf_node));
241 nir_after_block_before_jump(find_continue_block(loop)));
256 nir_block *continue_block = find_continue_block(loop);
315 /* opt_split_alu_of_phi() is able to peel that src from the loop */
333 * ALU instructions in the header block of a loop that meet the following
336 * - The loop has no continue instructions other than the "natural" continue
337 * at the bottom of the loop.
342 * dominates the block before the loop. The most common failure mode for
343 * this check is sources that are generated in the loop header block.
345 * - The phi node selects a constant or undef from the block before the loop or
349 * bottom of the loop and one at the block before the loop. The instruction
350 * before the loop computes the value on the first iteration, and the
353 * instruction before the loop or the one at the end, and uses of the original
356 * The splitting transforms a loop like:
361 * loop {
379 * loop {
393 opt_split_alu_of_phi(nir_builder *b, nir_loop *loop)
396 nir_block *header_block = nir_loop_first_block(loop);
398 nir_cf_node_as_block(nir_cf_node_prev(&loop->cf_node));
403 /* The loop must have exactly one continue block which could be a block
405 * last block in the loop back to the top.
410 nir_block *continue_block = find_continue_block(loop);
422 * to loop unrolling not recognizing loop termintators, and type
440 /* If the source is a phi in the loop header block, then the
478 * loop header), then the value must exist in prev_block.
551 * Simplify a bcsel whose sources are all phi nodes from the loop header block
553 * bcsel instructions in a loop that meet the following criteria can be
556 * - The loop has no continue instructions other than the "natural" continue
557 * at the bottom of the loop.
560 * loop.
566 * when entered from outside the loop and the remaining source when entered
579 * loop {
601 * loop {
618 * source of the bcsel that is selected when entering from outside the loop.
619 * The only restriction is that the source must be geneated outside the loop
621 * loop).
624 opt_simplify_bcsel_of_phi(nir_builder *b, nir_loop *loop)
627 nir_block *header_block = nir_loop_first_block(loop);
629 nir_cf_node_as_block(nir_cf_node_prev(&loop->cf_node));
634 /* The loop must have exactly one continue block which could be a block
636 * last block in the loop back to the top.
642 * of a loop. For now this is accomplished by only taking bcsels from the
678 nir_block *continue_block = find_continue_block(loop);
736 * loop {
748 * loop {
759 * loop can potentially be unrolled.
773 opt_if_loop_last_continue(nir_loop *loop, bool aggressive_last_continue)
779 /* Scan the control flow of the loop from the last to the first node
782 nir_block *last_block = nir_loop_last_block(loop);
824 /* Move the last block of the loop inside the last if-statement */
835 * continue now that the end of the loop has been simplified.
916 * phis afterwards. Single-source phis can be produced by loop unrolling
999 * loop {
1012 * loop {
1024 * loop {
1042 * loop {
1126 * This optimization simplifies potential loop terminators which then allows
1127 * other passes such as opt_if_simplification() and loop unrolling to progress
1182 * phis afterwards. Single-source phis can be produced by loop unrolling
1245 * loop {
1412 * loop.
1623 nir_loop *loop = nir_cf_node_as_loop(cf_node);
1624 progress |= opt_if_cf_list(b, &loop->body,
1626 progress |= opt_simplify_bcsel_of_phi(b, loop);
1627 progress |= opt_if_loop_last_continue(loop,
1668 nir_loop *loop = nir_cf_node_as_loop(cf_node);
1669 progress |= opt_if_regs_cf_list(&loop->body);
1670 progress |= opt_peel_loop_initial_if(loop);
1706 nir_loop *loop = nir_cf_node_as_loop(cf_node);
1707 progress |= opt_if_safe_cf_list(b, &loop->body);
1708 progress |= opt_split_alu_of_phi(b, loop);