<div dir="ltr"><div><div class="gmail_extra"><div class="gmail_quote">On Thu, May 5, 2016 at 10:10 AM, Connor Abbott <span dir="ltr"><<a href="mailto:cwabbott0@gmail.com" target="_blank">cwabbott0@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Connor Abbott <<a href="mailto:cwabbott0@gmail.com">cwabbott0@gmail.com</a>><br>
---<br>
 src/compiler/nir/nir.h | 22 ++++++++++++++++++----<br>
 1 file changed, 18 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h<br>
index 98451c6..8316b0d 100644<br>
--- a/src/compiler/nir/nir.h<br>
+++ b/src/compiler/nir/nir.h<br>
@@ -1995,19 +1995,33 @@ nir_after_block_before_jump(nir_block *block)<br>
 static inline nir_cursor<br>
 nir_before_cf_node(nir_cf_node *node)<br>
 {<br>
-   if (node->type == nir_cf_node_block)<br>
+   switch(node->type) {<br>
+   case nir_cf_node_block:<br>
       return nir_before_block(nir_cf_node_as_block(node));<br>
<br>
-   return nir_after_block(nir_cf_node_as_block(nir_cf_node_prev(node)));<br>
+   case nir_cf_node_function:<br>
+      return nir_before_block(<br>
+         nir_start_block(nir_cf_node_as_function(node)));<br></blockquote><div><br></div><div>I'm not sure what I think about this.  Every other nir_before_cf_node case that touches a "container" node puts it *before* the container not at the top of it.  This is a substantial edge-case.  What's the use-case?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
+   default:<br>
+      return nir_after_block(nir_cf_node_as_block(nir_cf_node_prev(node)));<br>
+   }<br>
 }<br>
<br>
 static inline nir_cursor<br>
 nir_after_cf_node(nir_cf_node *node)<br>
 {<br>
-   if (node->type == nir_cf_node_block)<br>
+   switch(node->type) {<br>
+   case nir_cf_node_block:<br>
       return nir_after_block(nir_cf_node_as_block(node));<br>
<br>
-   return nir_before_block(nir_cf_node_as_block(nir_cf_node_next(node)));<br>
+   case nir_cf_node_function:<br>
+      return nir_after_block(<br>
+         nir_impl_last_block(nir_cf_node_as_function(node)));<br>
+<br>
+   default:<br>
+      return nir_before_block(nir_cf_node_as_block(nir_cf_node_next(node)));<br>
+   }<br>
 }<br>
<br>
 static inline nir_cursor<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.5.5<br>
<br>
_______________________________________________<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/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div></div>