<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Dec 15, 2016 4:26 PM, "Kenneth Graunke" <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="elided-text">On Friday, December 16, 2016 10:17:33 AM PST Timothy Arceri wrote:<br>
> Reverting the previous attempt at this a5502a721fd30fd resulted in<br>
> the following Vulkan test failing.<br>
><br>
> dEQP-VK.glsl.return.return_in_<wbr>dynamic_loop_dynamic_vertex<br>
><br>
> This time we use the num_components from the alu dest rather than<br>
> num_inputs to the op to determine the size of the undef.<br>
><br>
> Cc: "13.0" <<a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.<wbr>freedesktop.org</a>><br>
> Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=99100" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/<wbr>show_bug.cgi?id=99100</a><br>
> ---<br>
>  src/compiler/nir/nir_opt_<wbr>undef.c | 12 ++++++------<br>
>  1 file changed, 6 insertions(+), 6 deletions(-)<br>
><br>
> diff --git a/src/compiler/nir/nir_opt_<wbr>undef.c b/src/compiler/nir/nir_opt_<wbr>undef.c<br>
> index c4777a8..8d3210c 100644<br>
> --- a/src/compiler/nir/nir_opt_<wbr>undef.c<br>
> +++ b/src/compiler/nir/nir_opt_<wbr>undef.c<br>
> @@ -79,22 +79,22 @@ opt_undef_vecN(nir_builder *b, nir_alu_instr *alu)<br>
>  {<br>
>     if (alu->op != nir_op_vec2 &&<br>
>         alu->op != nir_op_vec3 &&<br>
> -       alu->op != nir_op_vec4)<br>
> +       alu->op != nir_op_vec4 &&<br>
> +       alu->op != nir_op_fmov &&<br>
> +       alu->op != nir_op_imov)<br>
>        return false;<br>
><br>
>     assert(alu->dest.dest.is_ssa);<br>
><br>
> -   unsigned num_components = nir_op_infos[alu->op].num_<wbr>inputs;<br>
> -<br>
> -   for (unsigned i = 0; i < num_components; i++) {<br>
> +   for (unsigned i = 0; i < nir_op_infos[alu->op].num_<wbr>inputs; i++) {<br>
>        if (!alu->src[i].src.is_ssa ||<br>
>            alu->src[i].src.ssa->parent_<wbr>instr->type != nir_instr_type_ssa_undef)<br>
>           return false;<br>
>     }<br>
><br>
>     b->cursor = nir_before_instr(&alu->instr);<br>
> -   nir_ssa_def *undef =<br>
> -      nir_ssa_undef(b, num_components, nir_dest_bit_size(alu->dest.<wbr>dest));<br>
> +   nir_ssa_def *undef = nir_ssa_undef(b, alu->dest.dest.ssa.num_<wbr>components,<br>
> +                                      nir_dest_bit_size(alu->dest.<wbr>dest));<br>
>     nir_ssa_def_rewrite_uses(&alu-<wbr>>dest.dest.ssa, nir_src_for_ssa(undef));<br>
><br>
>     return true;<br>
><br>
<br>
</div>I don't understand why that test regressed...I suspect this is just<br>
hiding an actual bug.</blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Agreed.  We should probably look into that.</div><div dir="auto"><br></div><div dir="auto">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">  But the optimization looks right to me, so<br>
<br>
Reviewed-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br></blockquote></div></div></div></div>