Commit 71daf2ef authored by Danylo Piliaiev's avatar Danylo Piliaiev Committed by Dylan Baker

nir/loop_unroll: Prepare loop for unrolling in wrapper_unroll

Without loop_prepare_for_unroll loops are losing phis.

Fixes: 5db98195 "nir: add loop unroll support for wrapper loops"
Signed-off-by: Danylo Piliaiev's avatarDanylo Piliaiev <>
Reviewed-by: Timothy Arceri's avatarTimothy Arceri <>
(cherry picked from commit 84b3ef6a)
parent 614def1a
......@@ -560,31 +560,7 @@ wrapper_unroll(nir_loop *loop)
} else {
nir_block *blk_after_loop =
/* There may still be some single src phis following the loop that
* have not yet been cleaned up by another pass. Tidy those up
* before unrolling the loop.
nir_foreach_instr_safe(instr, blk_after_loop) {
if (instr->type != nir_instr_type_phi)
nir_phi_instr *phi = nir_instr_as_phi(instr);
assert(exec_list_length(&phi->srcs) == 1);
nir_phi_src *phi_src =
exec_node_data(nir_phi_src, exec_list_get_head(&phi->srcs), node);
nir_ssa_def_rewrite_uses(&phi->dest.ssa, phi_src->src);
/* Remove break at end of the loop */
nir_block *last_loop_blk = nir_loop_last_block(loop);
nir_instr *break_instr = nir_block_last_instr(last_loop_blk);
/* Pluck out the loop body. */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment