<div dir="ltr"><div>4 and 5 are</div><div><br></div><div>Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jul 23, 2018 at 3:03 AM Timothy Arceri <<a href="mailto:tarceri@itsqueeze.com">tarceri@itsqueeze.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">In order to be sure loop_terminator_list is an accurate<br>
representation of all the jumps in the loop we need to be sure we<br>
didn't encounter any other complex behaviour such as continues,<br>
nested breaks, etc during analysis.<br>
<br>
This will be used in the following patch.<br>
---<br>
src/compiler/nir/nir.h | 6 ++++++<br>
src/compiler/nir/nir_loop_analyze.c | 8 ++++++--<br>
2 files changed, 12 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h<br>
index 3bfe7d7f7bf..336a2ca5ac4 100644<br>
--- a/src/compiler/nir/nir.h<br>
+++ b/src/compiler/nir/nir.h<br>
@@ -1745,6 +1745,12 @@ typedef struct {<br>
/* Unroll the loop regardless of its size */<br>
bool force_unroll;<br>
<br>
+ /* Does the loop contain complex loop terminators, continues or other<br>
+ * complex behaviours? If this is true we can't rely on<br>
+ * loop_terminator_list to be complete or accurate.<br>
+ */<br>
+ bool complex_loop;<br>
+<br>
nir_loop_terminator *limiting_terminator;<br>
<br>
/* A list of loop_terminators terminating this loop. */<br>
diff --git a/src/compiler/nir/nir_loop_analyze.c b/src/compiler/nir/nir_loop_analyze.c<br>
index 5454b7691ba..9c3fd2f286f 100644<br>
--- a/src/compiler/nir/nir_loop_analyze.c<br>
+++ b/src/compiler/nir/nir_loop_analyze.c<br>
@@ -317,15 +317,19 @@ find_loop_terminators(loop_info_state *state)<br>
* not find a loop terminator, but there is a break-statement then<br>
* we should return false so that we do not try to find trip-count<br>
*/<br>
- if (!nir_is_trivial_loop_if(nif, break_blk))<br>
+ if (!nir_is_trivial_loop_if(nif, break_blk)) {<br>
+ state->loop->info->complex_loop = true;<br>
return false;<br>
+ }<br>
<br>
/* Continue if the if contained no jumps at all */<br>
if (!break_blk)<br>
continue;<br>
<br>
- if (nif->condition.ssa->parent_instr->type == nir_instr_type_phi)<br>
+ if (nif->condition.ssa->parent_instr->type == nir_instr_type_phi) {<br>
+ state->loop->info->complex_loop = true;<br>
return false;<br>
+ }<br>
<br>
nir_loop_terminator *terminator =<br>
rzalloc(state->loop->info, nir_loop_terminator);<br>
-- <br>
2.17.1<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>