<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Apr 6, 2018 at 2:47 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span>On Tue, Apr 03, 2018 at 11:32:51AM -0700, Jason Ekstrand wrote:<br>
> ---<br>
>  src/compiler/nir/nir_lower_sys<wbr>tem_values.c | 13 ++++++++++---<br>
>  1 file changed, 10 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/src/compiler/nir/nir_lower_s<wbr>ystem_values.c b/src/compiler/nir/nir_lower_s<wbr>ystem_values.c<br>
> index fb560ee..104df51 100644<br>
> --- a/src/compiler/nir/nir_lower_s<wbr>ystem_values.c<br>
> +++ b/src/compiler/nir/nir_lower_s<wbr>ystem_values.c<br>
> @@ -39,10 +39,15 @@ convert_block(nir_block *block, nir_builder *b)<br>
><br>
>        nir_intrinsic_instr *load_var = nir_instr_as_intrinsic(instr);<br>
><br>
> -      if (load_var->intrinsic != nir_intrinsic_load_var)<br>
> -         continue;<br>
> +      nir_variable *var;<br>
> +      if (load_var->intrinsic == nir_intrinsic_load_var) {<br>
> +         var = load_var->variables[0]->var;<br>
> +      } else if (load_var->intrinsic == nir_intrinsic_load_deref) {<br>
> +         var = nir_deref_instr_get_variable(n<wbr>ir_src_as_deref(load_var->src[<wbr>0]));<br>
<br>
</span>Question: nir_deref_instr_get_variable will walk the deref instr<br>
chain, but does it even make sense if there's a array or struct in<br>
this deref chain? Should this be asserted?<br>
</blockquote></div><br></div><div class="gmail_extra">That's an interesting question.  Certainly, at this point in the patch series, we can't make that assumption.  This is because we haven't checked the mode yet.  However, once we can assume deref instructions, we can check the mode and then go on to find the var.  Maybe something like this (untested):<br><br><a href="https://gitlab.freedesktop.org/jekstrand/mesa/commit/33aee39955eff842d6ea263da2f36e60287e62ee">https://gitlab.freedesktop.org/jekstrand/mesa/commit/33aee39955eff842d6ea263da2f36e60287e62ee</a><br></div></div>