Mesa (master): nir/opt_if: Remove open-coded nir_ssa_def_rewrite_uses()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Sep 30 16:12:09 UTC 2020


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

Author: Connor Abbott <cwabbott0 at gmail.com>
Date:   Tue Apr 16 19:31:45 2019 +0200

nir/opt_if: Remove open-coded nir_ssa_def_rewrite_uses()

So that we don't have to change these two places later.

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6866>

---

 src/compiler/nir/nir_opt_if.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/src/compiler/nir/nir_opt_if.c b/src/compiler/nir/nir_opt_if.c
index e4083a465cb..d507ceef275 100644
--- a/src/compiler/nir/nir_opt_if.c
+++ b/src/compiler/nir/nir_opt_if.c
@@ -493,16 +493,8 @@ opt_split_alu_of_phi(nir_builder *b, nir_loop *loop)
          /* Modify all readers of the original ALU instruction to read the
           * result of the phi.
           */
-         nir_foreach_use_safe(use_src, &alu->dest.dest.ssa) {
-            nir_instr_rewrite_src(use_src->parent_instr,
-                                  use_src,
+         nir_ssa_def_rewrite_uses(&alu->dest.dest.ssa,
                                   nir_src_for_ssa(&phi->dest.ssa));
-         }
-
-         nir_foreach_if_use_safe(use_src, &alu->dest.dest.ssa) {
-            nir_if_rewrite_condition(use_src->parent_if,
-                                     nir_src_for_ssa(&phi->dest.ssa));
-         }
 
          /* Since the original ALU instruction no longer has any readers, just
           * remove it.
@@ -713,16 +705,8 @@ opt_simplify_bcsel_of_phi(nir_builder *b, nir_loop *loop)
       /* Modify all readers of the bcsel instruction to read the result of
        * the phi.
        */
-      nir_foreach_use_safe(use_src, &bcsel->dest.dest.ssa) {
-         nir_instr_rewrite_src(use_src->parent_instr,
-                               use_src,
+      nir_ssa_def_rewrite_uses(&bcsel->dest.dest.ssa,
                                nir_src_for_ssa(&phi->dest.ssa));
-      }
-
-      nir_foreach_if_use_safe(use_src, &bcsel->dest.dest.ssa) {
-         nir_if_rewrite_condition(use_src->parent_if,
-                                  nir_src_for_ssa(&phi->dest.ssa));
-      }
 
       /* Since the original bcsel instruction no longer has any readers,
        * just remove it.



More information about the mesa-commit mailing list