[Mesa-dev] [PATCH 2/5] intel/compiler: Repeat nir_opt_algebraic_late until no more progress

Ian Romanick idr at freedesktop.org
Mon Aug 13 23:34:18 UTC 2018


From: Ian Romanick <ian.d.romanick at intel.com>

Withouth this, a pattern that creates a sequence that another pattern
can match will never perform the second match.  This can mean either
lost optimization opportunity (and a lot of frustration... "Why the
%@#$ isn't my optimization happening?!?") or, even worse, missed
lowering.

No shader-db changes on any platform.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/intel/compiler/brw_nir.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c
index 31ffbe613ec..4a6e9560643 100644
--- a/src/intel/compiler/brw_nir.c
+++ b/src/intel/compiler/brw_nir.c
@@ -776,7 +776,10 @@ brw_postprocess_nir(nir_shader *nir, const struct brw_compiler *compiler,
       OPT(brw_nir_opt_peephole_ffma);
    }
 
-   OPT(nir_opt_algebraic_late);
+   do {
+      progress = false;
+      OPT(nir_opt_algebraic_late);
+   } while (progress);
 
    OPT(nir_lower_to_source_mods);
    OPT(nir_copy_prop);
-- 
2.14.4



More information about the mesa-dev mailing list