While working with Tim on loop unrolling, I realized that the new NIR loop unrolling pass couldn't actually unroll any loops coming out of SPIR-V thanks to the way we handle continues. This little series adds two relatively small optimization passes that deal with this by peeling apart ifs at the tops of loops that take one branch on the first iteration and the other branch on all subsequent operations.
Jason Ekstrand (6): nir: Add a couple quick-and-dirty out-of-SSA helpers nir: Correctly handle blocks in cf_node_cf_tree_next nir: Expose function_impl versions of copy-prop and dce nir: Add an optimization pass to remove trivial continues nir: Add a pass for moving SPIR-V continue blocks to the ends of loops i965: Use nir_opt_trivial_continues and nir_opt_if src/compiler/Makefile.sources | 2 + src/compiler/nir/nir.c | 2 +- src/compiler/nir/nir.h | 9 + src/compiler/nir/nir_from_ssa.c | 189 ++++++++++++++++++-- src/compiler/nir/nir_opt_copy_propagate.c | 2 +- src/compiler/nir/nir_opt_dce.c | 2 +- src/compiler/nir/nir_opt_if.c | 253 +++++++++++++++++++++++++++ src/compiler/nir/nir_opt_trivial_continues.c | 141 +++++++++++++++ src/mesa/drivers/dri/i965/brw_nir.c | 2 + 9 files changed, 587 insertions(+), 15 deletions(-) create mode 100644 src/compiler/nir/nir_opt_if.c create mode 100644 src/compiler/nir/nir_opt_trivial_continues.c -- 2.5.0.400.gff86faf _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev