<div dir="ltr">Pushed!  Thanks.<br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 12, 2019 at 5:42 PM Timothy Arceri <<a href="mailto:tarceri@itsqueeze.com">tarceri@itsqueeze.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On 13/3/19 8:30 am, Jason Ekstrand wrote:<br>
> The previous code was completely broken when it came to constructing the<br>
> undef values.  I'm not sure how it ever worked.  For the case of a copy<br>
> that reads an undefined value, we can just delete the copy because the<br>
> destination is a valid undefined value.  This saves us the effort of<br>
> trying to construct a value for an arbitrary copy_deref intrinsic.<br>
<br>
Yes. It turns out this was indeed not required. Thanks for the fix!<br>
<br>
Reviewed-by: Timothy Arceri <<a href="mailto:tarceri@itsqueeze.com" target="_blank">tarceri@itsqueeze.com</a>><br>
<br>
> <br>
> Fixes: e8a8937a04 "nir: add partial loop unrolling support"<br>
> Cc: Timothy Arceri <<a href="mailto:tarceri@itsqueeze.com" target="_blank">tarceri@itsqueeze.com</a>><br>
> ---<br>
>   src/compiler/nir/nir_opt_loop_unroll.c | 14 ++------------<br>
>   1 file changed, 2 insertions(+), 12 deletions(-)<br>
> <br>
> diff --git a/src/compiler/nir/nir_opt_loop_unroll.c b/src/compiler/nir/nir_opt_loop_unroll.c<br>
> index 06ec78b8068..b2696d4aadb 100644<br>
> --- a/src/compiler/nir/nir_opt_loop_unroll.c<br>
> +++ b/src/compiler/nir/nir_opt_loop_unroll.c<br>
> @@ -670,11 +670,9 @@ remove_out_of_bounds_induction_use(nir_shader *shader, nir_loop *loop,<br>
>               if (is_access_out_of_bounds(term, nir_src_as_deref(intrin->src[0]),<br>
>                                           trip_count)) {<br>
>                  if (intrin->intrinsic == nir_intrinsic_load_deref) {<br>
> -                  assert(intrin->src[0].is_ssa);<br>
> -                  nir_ssa_def *a_ssa = intrin->src[0].ssa;<br>
>                     nir_ssa_def *undef =<br>
> -                     nir_ssa_undef(&b, intrin->num_components,<br>
> -                                   a_ssa->bit_size);<br>
> +                     nir_ssa_undef(&b, intrin->dest.ssa.num_components,<br>
> +                                   intrin->dest.ssa.bit_size);<br>
>                     nir_ssa_def_rewrite_uses(&intrin->dest.ssa,<br>
>                                              nir_src_for_ssa(undef));<br>
>                  } else {<br>
> @@ -686,14 +684,6 @@ remove_out_of_bounds_induction_use(nir_shader *shader, nir_loop *loop,<br>
>               if (intrin->intrinsic == nir_intrinsic_copy_deref &&<br>
>                   is_access_out_of_bounds(term, nir_src_as_deref(intrin->src[1]),<br>
>                                           trip_count)) {<br>
> -               assert(intrin->src[1].is_ssa);<br>
> -               nir_ssa_def *a_ssa = intrin->src[1].ssa;<br>
> -               nir_ssa_def *undef =<br>
> -                  nir_ssa_undef(&b, intrin->num_components, a_ssa->bit_size);<br>
> -<br>
> -               /* Replace the copy with a store of the undefined value */<br>
> -               b.cursor = nir_before_instr(instr);<br>
> -               nir_store_deref(&b, nir_src_as_deref(intrin->src[0]), undef, ~0);<br>
>                  nir_instr_remove(instr);<br>
>               }<br>
>            }<br>
> <br>
</blockquote></div>