<div dir="ltr"><div><div>I tweaked your commit messages a bit, added my R-B to this one, and pushed.<br><br></div>And... Now I get to rebase my deref patches again. :-P<br><br></div>--Jason<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Apr 10, 2018 at 11:13 PM, Caio Marcelo de Oliveira Filho <span dir="ltr"><<a href="mailto:caio.oliveira@intel.com" target="_blank">caio.oliveira@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">The matching code doesn't make real use of the return value. The main<br>
function return value is ignored, and while the worker function<br>
propagate its return value, the actual callback never returns false.<br>
<br>
</span>v2: Style fixes. (Jason)<br>
---<br>
 src/compiler/nir/nir_lower_<wbr>vars_to_ssa.c | 67 +++++++++++-------------<br>
 1 file changed, 31 insertions(+), 36 deletions(-)<br>
<br>
diff --git a/src/compiler/nir/nir_lower_<wbr>vars_to_ssa.c b/src/compiler/nir/nir_lower_<wbr>vars_to_ssa.c<br>
index 970eb05307..8bc847fd41 100644<br>
--- a/src/compiler/nir/nir_lower_<wbr>vars_to_ssa.c<br>
+++ b/src/compiler/nir/nir_lower_<wbr>vars_to_ssa.c<br>
@@ -217,45 +217,42 @@ get_deref_node(nir_deref_var *deref, struct lower_variables_state *state)<br>
<span class=""> }<br>
<br>
 /* \sa foreach_deref_node_match */<br>
-static bool<br>
+static void<br>
 foreach_deref_node_worker(<wbr>struct deref_node *node, nir_deref *deref,<br>
-                          bool (* cb)(struct deref_node *node,<br>
+                          void (* cb)(struct deref_node *node,<br>
                                       struct lower_variables_state *state),<br>
                           struct lower_variables_state *state)<br>
 {<br>
    if (deref->child == NULL) {<br>
-      return cb(node, state);<br>
-   } else {<br>
-      switch (deref->child->deref_type) {<br>
-      case nir_deref_type_array: {<br>
-         nir_deref_array *arr = nir_deref_as_array(deref-><wbr>child);<br>
-         assert(arr->deref_array_type == nir_deref_array_type_direct);<br>
-         if (node->children[arr->base_<wbr>offset] &&<br>
-             !foreach_deref_node_worker(<wbr>node->children[arr->base_<wbr>offset],<br>
-                                        deref->child, cb, state))<br>
-            return false;<br>
</span><span class="">+      cb(node, state);<br>
+      return;<br>
+   }<br>
<br>
</span>-         if (node->wildcard &&<br>
<span class="">-             !foreach_deref_node_worker(<wbr>node->wildcard,<br>
-                                        deref->child, cb, state))<br>
-            return false;<br>
</span><span class="">+   switch (deref->child->deref_type) {<br>
+   case nir_deref_type_array: {<br>
+      nir_deref_array *arr = nir_deref_as_array(deref-><wbr>child);<br>
+      assert(arr->deref_array_type == nir_deref_array_type_direct);<br>
<br>
</span>-         return true;<br>
<span class="">+      if (node->children[arr->base_<wbr>offset]) {<br>
+         foreach_deref_node_worker(<wbr>node->children[arr->base_<wbr>offset],<br>
+                                   deref->child, cb, state);<br>
       }<br>
</span><span class="">+      if (node->wildcard)<br>
+         foreach_deref_node_worker(<wbr>node->wildcard, deref->child, cb, state);<br>
+      break;<br>
+   }<br>
<br>
</span>-      case nir_deref_type_struct: {<br>
<span class="">-         nir_deref_struct *str = nir_deref_as_struct(deref-><wbr>child);<br>
-         if (node->children[str->index] &&<br>
-             !foreach_deref_node_worker(<wbr>node->children[str->index],<br>
-                                        deref->child, cb, state))<br>
-            return false;<br>
</span>-<br>
-         return true;<br>
<span class="">+   case nir_deref_type_struct: {<br>
+      nir_deref_struct *str = nir_deref_as_struct(deref-><wbr>child);<br>
+      if (node->children[str->index]) {<br>
+         foreach_deref_node_worker(<wbr>node->children[str->index],<br>
+                                   deref->child, cb, state);<br>
       }<br>
</span><span class="">+      break;<br>
+   }<br>
<br>
-      default:<br>
-         unreachable("Invalid deref child type");<br>
-      }<br>
+   default:<br>
+      unreachable("Invalid deref child type");<br>
    }<br>
 }<br>
<br>
</span>@@ -271,9 +268,9 @@ foreach_deref_node_worker(<wbr>struct deref_node *node, nir_deref *deref,<br>
<span class="">  * The given deref must be a full-length and fully qualified (no wildcards<br>
  * or indirects) deref chain.<br>
  */<br>
-static bool<br>
+static void<br>
 foreach_deref_node_match(nir_<wbr>deref_var *deref,<br>
-                         bool (* cb)(struct deref_node *node,<br>
+                         void (* cb)(struct deref_node *node,<br>
                                      struct lower_variables_state *state),<br>
                          struct lower_variables_state *state)<br>
 {<br>
</span>@@ -282,9 +279,9 @@ foreach_deref_node_match(nir_<wbr>deref_var *deref,<br>
<span class="">    struct deref_node *node = get_deref_node(&var_deref, state);<br>
<br>
</span><span class="">    if (node == NULL)<br>
-      return false;<br>
</span>+      return;<br>
<span class=""><br>
-   return foreach_deref_node_worker(<wbr>node, &deref->deref, cb, state);<br>
</span>+   foreach_deref_node_worker(<wbr>node, &deref->deref, cb, state);<br>
 }<br>
<br>
 /* \sa deref_may_be_aliased */<br>
@@ -441,12 +438,12 @@ register_variable_uses(nir_<wbr>function_impl *impl,<br>
<span class=""> /* Walks over all of the copy instructions to or from the given deref_node<br>
  * and lowers them to load/store intrinsics.<br>
  */<br>
-static bool<br>
+static void<br>
 lower_copies_to_load_store(<wbr>struct deref_node *node,<br>
                            struct lower_variables_state *state)<br>
 {<br>
    if (!node->copies)<br>
-      return true;<br>
+      return;<br>
<br>
    struct set_entry *copy_entry;<br>
    set_foreach(node->copies, copy_entry) {<br>
</span>@@ -471,8 +468,6 @@ lower_copies_to_load_store(<wbr>struct deref_node *node,<br>
<div class="HOEnZb"><div class="h5">    }<br>
<br>
    node->copies = NULL;<br>
-<br>
-   return true;<br>
 }<br>
<br>
 /* Performs variable renaming<br>
--<br>
2.17.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</div></div></blockquote></div><br></div>