panfrost/midgard: Optimize MIR in progress loop
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Mon, 22 Apr 2019 04:58:53 +0000 (04:58 +0000)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Wed, 24 Apr 2019 02:22:32 +0000 (02:22 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
src/gallium/drivers/panfrost/midgard/midgard_compile.c

index d297e505c1c56547822b76d3bd4cd5992d889a4e..2c259ea525ab8e9a69f45ebaa6639441c39aebd4 100644 (file)
@@ -3685,12 +3685,18 @@ midgard_compile_shader_nir(nir_shader *nir, midgard_program *program, bool is_bl
 
         util_dynarray_init(compiled, NULL);
 
-        /* Peephole optimizations */
+        /* MIR-level optimizations */
 
-        mir_foreach_block(ctx, block) {
-                midgard_opt_copy_prop(ctx, block);
-                midgard_opt_dead_code_eliminate(ctx, block);
-        }
+        bool progress = false;
+
+        do {
+                progress = false;
+
+                mir_foreach_block(ctx, block) {
+                        progress |= midgard_opt_copy_prop(ctx, block);
+                        progress |= midgard_opt_dead_code_eliminate(ctx, block);
+                }
+        } while (progress);
 
         /* Schedule! */
         schedule_program(ctx);