From aea311dbef41aae574d8a2c48bf04908343292d7 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Sun, 9 Oct 2022 18:08:18 +0200 Subject: [PATCH] r600/sfn: run cleanup passes after late algebraic opt Signed-off-by: Gert Wollny Reviewed-by: Emma Anholt Part-of: --- src/gallium/drivers/r600/sfn/sfn_nir.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/r600/sfn/sfn_nir.cpp b/src/gallium/drivers/r600/sfn/sfn_nir.cpp index 6edf79037ac..f44f1ca145f 100644 --- a/src/gallium/drivers/r600/sfn/sfn_nir.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_nir.cpp @@ -795,8 +795,18 @@ int r600_shader_from_nir(struct r600_context *rctx, while (optimize_once(sh)); - NIR_PASS_V(sh, nir_lower_bool_to_int32); - NIR_PASS_V(sh, nir_opt_algebraic_late); + bool late_algebraic_progress; + do + { + late_algebraic_progress = false; + NIR_PASS(late_algebraic_progress, sh, nir_opt_algebraic_late); + NIR_PASS(late_algebraic_progress, sh, nir_opt_constant_folding); + NIR_PASS(late_algebraic_progress, sh, nir_copy_prop); + NIR_PASS(late_algebraic_progress, sh, nir_opt_dce); + NIR_PASS(late_algebraic_progress, sh, nir_opt_cse); + } while (late_algebraic_progress); + + NIR_PASS_V(sh, nir_lower_bool_to_int32); if (sh->info.stage == MESA_SHADER_FRAGMENT) r600::sort_fsoutput(sh);