summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanylo Piliaiev <danylo.piliaiev@globallogic.com>2019-08-19 18:13:12 +0300
committerDylan Baker <dylan@pnwbakers.com>2019-09-04 11:50:48 -0700
commit71daf2ef6771f96aa748caae77c7e6ef31faf43f (patch)
treefb1f23bb6ff90c484552efffc10110605f067ea5
parent614def1a897b22fc0e943f5fb0da9b0fd2d8d71a (diff)
downloadmesa-71daf2ef6771f96aa748caae77c7e6ef31faf43f.tar.gz
nir/loop_unroll: Prepare loop for unrolling in wrapper_unroll
Without loop_prepare_for_unroll loops are losing phis. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111411 Fixes: 5db98195 "nir: add loop unroll support for wrapper loops" Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> (cherry picked from commit 84b3ef6a96eabc28b18e8cdf1b0d61826b1a8a67)
-rw-r--r--src/compiler/nir/nir_opt_loop_unroll.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/src/compiler/nir/nir_opt_loop_unroll.c b/src/compiler/nir/nir_opt_loop_unroll.c
index 55075824507..743581f6b34 100644
--- a/src/compiler/nir/nir_opt_loop_unroll.c
+++ b/src/compiler/nir/nir_opt_loop_unroll.c
@@ -560,31 +560,7 @@ wrapper_unroll(nir_loop *loop)
nir_after_block(nir_if_last_else_block(terminator->nif));
}
} else {
- nir_block *blk_after_loop =
- nir_cursor_current_block(nir_after_cf_node(&loop->cf_node));
-
- /* 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)
- break;
-
- 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);
- nir_instr_remove(instr);
- }
-
- /* 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);
- nir_instr_remove(break_instr);
+ loop_prepare_for_unroll(loop);
}
/* Pluck out the loop body. */