<div dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><br><div class="gmail_quote"><div dir="ltr">On Thu, Dec 6, 2018 at 9:08 PM Timothy Arceri <<a href="mailto:tarceri@itsqueeze.com">tarceri@itsqueeze.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Reviewed-by: Thomas Helland <<a href="mailto:thomashelland90@gmail.com" target="_blank">thomashelland90@gmail.com</a>><br>
---<br>
 src/compiler/nir/nir_loop_analyze.c | 31 ++++++++++-------------------<br>
 1 file changed, 10 insertions(+), 21 deletions(-)<br>
<br>
diff --git a/src/compiler/nir/nir_loop_analyze.c b/src/compiler/nir/nir_loop_analyze.c<br>
index 9c3fd2f286..c779383b36 100644<br>
--- a/src/compiler/nir/nir_loop_analyze.c<br>
+++ b/src/compiler/nir/nir_loop_analyze.c<br>
@@ -624,8 +624,7 @@ find_trip_count(loop_info_state *state)<br>
 }<br>
<br>
 static bool<br>
-force_unroll_array_access(loop_info_state *state, nir_shader *ns,<br>
-Â Â Â Â Â Â Â Â Â Â Â Â Â nir_deref_instr *deref)<br>
+force_unroll_array_access(loop_info_state *state, nir_deref_instr *deref)<br>
 {<br>
  for (nir_deref_instr *d = deref; d; d = nir_deref_instr_parent(d)) {<br>
    if (d->deref_type != nir_deref_type_array)<br>
@@ -640,23 +639,18 @@ force_unroll_array_access(loop_info_state *state, nir_shader *ns,<br>
    nir_deref_instr *parent = nir_deref_instr_parent(d);<br>
    assert(glsl_type_is_array(parent->type) ||<br>
       glsl_type_is_matrix(parent->type));<br>
-Â Â Â if (glsl_get_length(parent->type) == state->loop->info->trip_count) {<br>
-Â Â Â Â Â state->loop->info->force_unroll = true;<br>
+Â Â Â if (glsl_get_length(parent->type) == state->loop->info->trip_count)<br>
     return true;<br>
-Â Â Â }<br>
<br>
-Â Â Â if (deref->mode & state->indirect_mask) {<br>
-Â Â Â Â Â state->loop->info->force_unroll = true;<br>
+Â Â Â if (deref->mode & state->indirect_mask)<br>
     return true;<br>
-Â Â Â }<br>
  }<br>
<br>
  return false;<br>
 }<br>
<br>
 static bool<br>
-force_unroll_heuristics(loop_info_state *state, nir_shader *ns,<br>
-Â Â Â Â Â Â Â Â Â Â Â Â nir_block *block)<br>
+force_unroll_heuristics(loop_info_state *state, nir_block *block)<br>
 {<br>
  nir_foreach_instr(instr, block) {<br>
    if (instr->type != nir_instr_type_intrinsic)<br>
@@ -670,12 +664,12 @@ force_unroll_heuristics(loop_info_state *state, nir_shader *ns,<br>
    if (intrin->intrinsic == nir_intrinsic_load_deref ||<br>
      intrin->intrinsic == nir_intrinsic_store_deref ||<br>
      intrin->intrinsic == nir_intrinsic_copy_deref) {<br>
-Â Â Â Â Â if (force_unroll_array_access(state, ns,<br>
+Â Â Â Â Â if (force_unroll_array_access(state,<br>
                    nir_src_as_deref(intrin->src[0])))<br>
       return true;<br>
<br>
     if (intrin->intrinsic == nir_intrinsic_copy_deref &&<br>
-Â Â Â Â Â Â Â force_unroll_array_access(state, ns,<br>
+Â Â Â Â Â Â Â force_unroll_array_access(state,<br>
                    nir_src_as_deref(intrin->src[1])))<br>
       return true;<br>
    }<br>
@@ -745,15 +739,10 @@ get_loop_info(loop_info_state *state, nir_function_impl *impl)<br>
  find_trip_count(state);<br>
<br>
  nir_shader *ns = impl->function->shader;<br>
-Â Â foreach_list_typed_safe(nir_cf_node, node, node, &state->loop->body) {<br>
-Â Â Â if (node->type == nir_cf_node_block) {<br>
-Â Â Â Â Â if (force_unroll_heuristics(state, ns, nir_cf_node_as_block(node)))<br>
-Â Â Â Â Â Â break;<br>
-Â Â Â } else {<br>
-Â Â Â Â Â nir_foreach_block_in_cf_node(block, node) {<br>
-Â Â Â Â Â Â if (force_unroll_heuristics(state, ns, block))<br>
-Â Â Â Â Â Â Â Â break;<br>
-Â Â Â Â Â }<br>
+Â Â nir_foreach_block_in_cf_node(block, &state->loop->cf_node) {<br>
+Â Â Â if (force_unroll_heuristics(state, block)) {<br>
+Â Â Â Â Â state->loop->info->force_unroll = true;<br>
+Â Â Â Â Â break;<br>
    }<br>
  }<br>
 }<br>
-- <br>
2.19.2<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">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/mailman/listinfo/mesa-dev</a><br>
</blockquote></div>