freedreno/ir3/dce: report progress
authorRob Clark <robdclark@chromium.org>
Thu, 14 May 2020 18:39:14 +0000 (11:39 -0700)
committerMarge Bot <eric+marge@anholt.net>
Tue, 19 May 2020 16:06:17 +0000 (16:06 +0000)
Eventually we'll pull the iteration out of the pass itself, but the
first step is to just report progress.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5048>

src/freedreno/ir3/ir3.h
src/freedreno/ir3/ir3_dce.c

index 76fdcdf7a7d849c31f051fca1ecc58cd92080dd8..3b4ffb29d29befd50f44320b64e75d5f67cdbf5f 100644 (file)
@@ -1192,7 +1192,7 @@ void ir3_remove_nops(struct ir3 *ir);
 
 /* dead code elimination: */
 struct ir3_shader_variant;
-void ir3_dce(struct ir3 *ir, struct ir3_shader_variant *so);
+bool ir3_dce(struct ir3 *ir, struct ir3_shader_variant *so);
 
 /* fp16 conversion folding */
 void ir3_cf(struct ir3 *ir);
index 0bd8af537f40157c14876c653844e230d2dfe189..6c86d6356b830ab9cf8de07a2c9d0229de673fc6 100644 (file)
@@ -178,17 +178,20 @@ find_and_remove_unused(struct ir3 *ir, struct ir3_shader_variant *so)
        return progress;
 }
 
-void
+bool
 ir3_dce(struct ir3 *ir, struct ir3_shader_variant *so)
 {
        void *mem_ctx = ralloc_context(NULL);
-       bool progress;
+       bool progress, made_progress = false;
 
        ir3_find_ssa_uses(ir, mem_ctx, true);
 
        do {
                progress = find_and_remove_unused(ir, so);
+               made_progress |= progress;
        } while (progress);
 
        ralloc_free(mem_ctx);
+
+       return made_progress;
 }