i965: Use nir_opt_trivial_continues and nir_opt_if
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 17 Dec 2016 07:30:40 +0000 (23:30 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Fri, 23 Dec 2016 00:27:19 +0000 (16:27 -0800)
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
src/mesa/drivers/dri/i965/brw_nir.c

index a52d614..6f37e97 100644 (file)
@@ -429,6 +429,15 @@ nir_optimize(nir_shader *nir, const struct brw_compiler *compiler,
       OPT(nir_opt_algebraic);
       OPT(nir_opt_constant_folding);
       OPT(nir_opt_dead_cf);
+      if (OPT(nir_opt_trivial_continues)) {
+         /* If nir_opt_trivial_continues makes progress, then we need to clean
+          * things up if we want any hope of nir_opt_if or nir_opt_loop_unroll
+          * to make progress.
+          */
+         OPT(nir_copy_prop);
+         OPT(nir_opt_dce);
+      }
+      OPT(nir_opt_if);
       if (nir->options->max_unroll_iterations != 0) {
          OPT(nir_opt_loop_unroll, indirect_mask);
       }