<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>