<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 16, 2015 at 12:46 PM, 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">I gave my r-b on v1 since I couldn't find the v2 and you hadn't sent<br>
the v3 yet. We'll figure out the rest of it later.<br><div><div class="h5"></div></div></blockquote><div><br></div><div>Noted.  I'll get that added.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
On Mon, Feb 9, 2015 at 11:24 PM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
> Previously, if you remved a CF node that still had instructions in it, none<br>
> of the use/def information from those instructions would get cleaned up.<br>
> Also, we weren't removing if statements from the if_uses of the<br>
> corresponding register or SSA def.  This commit fixes both of these<br>
> problems<br>
> ---<br>
>  src/glsl/nir/nir.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++<br>
>  1 file changed, 54 insertions(+)<br>
><br>
> diff --git a/src/glsl/nir/nir.c b/src/glsl/nir/nir.c<br>
> index 9a88bd3..8ea7bb5 100644<br>
> --- a/src/glsl/nir/nir.c<br>
> +++ b/src/glsl/nir/nir.c<br>
> @@ -1148,6 +1148,58 @@ stitch_blocks(nir_block *before, nir_block *after)<br>
>     exec_node_remove(&after->cf_node.node);<br>
>  }<br>
><br>
> +static void<br>
> +remove_defs_uses(nir_instr *instr);<br>
> +<br>
> +static void<br>
> +cleanup_cf_node(nir_cf_node *node)<br>
> +{<br>
> +   switch (node->type) {<br>
> +   case nir_cf_node_block: {<br>
> +      nir_block *block = nir_cf_node_as_block(node);<br>
> +      /* We need to walk the instructions and clean up defs/uses */<br>
> +      nir_foreach_instr(block, instr)<br>
> +         remove_defs_uses(instr);<br>
> +      break;<br>
> +   }<br>
> +<br>
> +   case nir_cf_node_if: {<br>
> +      nir_if *if_stmt = nir_cf_node_as_if(node);<br>
> +      foreach_list_typed(nir_cf_node, child, node, &if_stmt->then_list)<br>
> +         cleanup_cf_node(child);<br>
> +      foreach_list_typed(nir_cf_node, child, node, &if_stmt->else_list)<br>
> +         cleanup_cf_node(child);<br>
> +<br>
> +      struct set *if_uses;<br>
> +      if (if_stmt->condition.is_ssa) {<br>
> +         if_uses = if_stmt->condition.ssa->if_uses;<br>
> +      } else {<br>
> +         if_uses = if_stmt->condition.reg.reg->if_uses;<br>
> +      }<br>
> +<br>
> +      struct set_entry *entry = _mesa_set_search(if_uses, if_stmt);<br>
> +      assert(entry);<br>
> +      _mesa_set_remove(if_uses, entry);<br>
> +      break;<br>
> +   }<br>
> +<br>
> +   case nir_cf_node_loop: {<br>
> +      nir_loop *loop = nir_cf_node_as_loop(node);<br>
> +      foreach_list_typed(nir_cf_node, child, node, &loop->body)<br>
> +         cleanup_cf_node(child);<br>
> +      break;<br>
> +   }<br>
> +   case nir_cf_node_function: {<br>
> +      nir_function_impl *impl = nir_cf_node_as_function(node);<br>
> +      foreach_list_typed(nir_cf_node, child, node, &impl->body)<br>
> +         cleanup_cf_node(child);<br>
> +      break;<br>
> +   }<br>
> +   default:<br>
> +      unreachable("Invalid CF node type");<br>
> +   }<br>
> +}<br>
> +<br>
>  void<br>
>  nir_cf_node_remove(nir_cf_node *node)<br>
>  {<br>
> @@ -1175,6 +1227,8 @@ nir_cf_node_remove(nir_cf_node *node)<br>
>        exec_node_remove(&node->node);<br>
>        stitch_blocks(before_block, after_block);<br>
>     }<br>
> +<br>
> +   cleanup_cf_node(node);<br>
>  }<br>
><br>
>  static bool<br>
> --<br>
> 2.2.2<br>
><br>
</div></div>> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div></div>