Module: Mesa
Branch: master
Commit: 10e508c8156785e6481bff37b3446c347aa56fea
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=10e508c8156785e6481bff37b3446c347aa56fea

Author: Daniel Schürmann <[email protected]>
Date:   Fri Sep 27 12:49:06 2019 +0200

freedreno: Enable the nir_opt_algebraic_late() pass.

Reviewed-by: Rob Clark <[email protected]>
Reviewed-by: Connor Abbott <[email protected]>

---

 src/freedreno/ir3/ir3_nir.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c
index 0a62523ccce..9342c9d299b 100644
--- a/src/freedreno/ir3/ir3_nir.c
+++ b/src/freedreno/ir3/ir3_nir.c
@@ -263,6 +263,20 @@ ir3_optimize_nir(struct ir3_shader *shader, nir_shader *s,
        if (ubo_progress || idiv_progress)
                ir3_optimize_loop(s);
 
+       /* Do late algebraic optimization to turn add(a, neg(b)) back into
+       * subs, then the mandatory cleanup after algebraic.  Note that it may
+       * produce fnegs, and if so then we need to keep running to squash
+       * fneg(fneg(a)).
+       */
+       bool more_late_algebraic = true;
+       while (more_late_algebraic) {
+               more_late_algebraic = OPT(s, nir_opt_algebraic_late);
+               OPT_V(s, nir_opt_constant_folding);
+               OPT_V(s, nir_copy_prop);
+               OPT_V(s, nir_opt_dce);
+               OPT_V(s, nir_opt_cse);
+       }
+
        OPT_V(s, nir_remove_dead_variables, nir_var_function_temp);
 
        OPT_V(s, nir_opt_sink, nir_move_const_undef);

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to