Mesa (master): nir: fix nir_opt_copy_prop_vars() for arrays of arrays

Timothy Arceri tarceri at kemper.freedesktop.org
Wed Jul 19 01:06:39 UTC 2017


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

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Fri Jun 30 12:03:18 2017 +1000

nir: fix nir_opt_copy_prop_vars() for arrays of arrays

Previously we only incremented the guide for a single
dimension/wildcard.

V2: rework logic to avoid code duplication

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Cc: mesa-stable at lists.freedesktop.org

---

 src/compiler/nir/nir_opt_copy_prop_vars.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/compiler/nir/nir_opt_copy_prop_vars.c b/src/compiler/nir/nir_opt_copy_prop_vars.c
index 7f17469f64..89ddc8dd40 100644
--- a/src/compiler/nir/nir_opt_copy_prop_vars.c
+++ b/src/compiler/nir/nir_opt_copy_prop_vars.c
@@ -469,8 +469,8 @@ specialize_wildcards(nir_deref_var *deref,
    nir_deref_var *ret = nir_deref_var_create(mem_ctx, deref->var);
 
    nir_deref *deref_tail = deref->deref.child;
-   nir_deref *guide_tail = guide->deref.child;
-   nir_deref *spec_tail = specific->deref.child;
+   nir_deref *guide_tail = &guide->deref;
+   nir_deref *spec_tail = &specific->deref;
    nir_deref *ret_tail = &ret->deref;
    while (deref_tail) {
       switch (deref_tail->deref_type) {
@@ -495,14 +495,14 @@ specialize_wildcards(nir_deref_var *deref,
              * the entry deref to find its corresponding wildcard and fill
              * this slot in with the value from the src.
              */
-            while (guide_tail) {
+            while (guide_tail->child) {
+               guide_tail = guide_tail->child;
+               spec_tail = spec_tail->child;
+
                if (guide_tail->deref_type == nir_deref_type_array &&
                    nir_deref_as_array(guide_tail)->deref_array_type ==
                    nir_deref_array_type_wildcard)
                   break;
-
-               guide_tail = guide_tail->child;
-               spec_tail = spec_tail->child;
             }
 
             nir_deref_array *spec_arr = nir_deref_as_array(spec_tail);




More information about the mesa-commit mailing list