vc4: Also enable phi elimination.
authorEric Anholt <eric@anholt.net>
Wed, 6 Jul 2016 22:21:53 +0000 (15:21 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 12 Jul 2016 22:47:25 +0000 (15:47 -0700)
This avoids a bunch of code gen regressions when enabling loops in vc4.

Prior to that, the GLSL that would have generated these optimizable phi
nodes was being lowered to csels between either (undef, a) or (a, a), and
those were being dealt with by nir_opt_undef and nir_opt_algebraic.

src/gallium/drivers/vc4/vc4_program.c

index 8305459454b63cfeb021d08dfb97363be469d2ad..20e2850e625a3602cc9767fde29052cd35c57992 100644 (file)
@@ -1336,6 +1336,7 @@ vc4_optimize_nir(struct nir_shader *s)
                 NIR_PASS_V(s, nir_lower_phis_to_scalar);
 
                 NIR_PASS(progress, s, nir_copy_prop);
+                NIR_PASS(progress, s, nir_opt_remove_phis);
                 NIR_PASS(progress, s, nir_opt_dce);
                 NIR_PASS(progress, s, nir_opt_dead_cf);
                 NIR_PASS(progress, s, nir_opt_cse);