<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Apr 5, 2018 at 12:55 PM, Caio Marcelo de Oliveira Filho <span dir="ltr"><<a href="mailto:caio.oliveira@intel.com" target="_blank">caio.oliveira@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<span class=""><br>
> +static nir_deref_instr *<br>
> +build_deref_to_next_wildcard(<wbr>nir_builder *b,<br>
> + nir_deref_instr *parent,<br>
> + nir_deref_instr ***deref_arr)<br>
> +{<br>
> + for (; **deref_arr; (*deref_arr)++) {<br>
> + if ((**deref_arr)->deref_type == nir_deref_type_array_wildcard)<br>
> + return parent;<br>
> +<br>
> + parent = nir_build_deref_follower(b, parent, **deref_arr);<br>
> + }<br>
> +<br>
> + assert(**deref_arr == NULL);<br>
> + *deref_arr = NULL;<br>
> + return parent;<br>
> +}<br>
<br>
</span>Question: in a scenario where there are no wildcards in the chain,<br>
could we just return the original deref (i.e. the last element in<br>
deref_arr)?<br>
</blockquote></div><br></div><div class="gmail_extra">Yes, and nir_build_deref_follower magically does that. :-) It's admittedly a bit sketchy because we don't know if the if the follower actually dominates the current builder cursor but all of the callers in this series do have that guarantee.<br></div></div>