[Mesa-dev] [PATCH v4 5/7] nir/opt_loop_unroll: Remove unneeded phis if we make progress

Jason Ekstrand jason at jlekstrand.net
Tue Aug 28 17:29:43 UTC 2018


I'm not a huge fan of calling copy-prop here but I also don't see an easy
way around it.

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

On Mon, Aug 27, 2018 at 4:09 AM Timothy Arceri <tarceri at itsqueeze.com>
wrote:

> Now that SSA values can be derefs and they have special rules, we have
> to be a bit more careful about our LCSSA phis.  In particular, we need
> to clean up in case LCSSA ended up creating a phi node for a deref.
> This avoids validation issues with some CTS tests with the following
> patch, but its possible this we could also see the same problem with
> the existing unrolling passes.
> ---
>  src/compiler/nir/nir_opt_loop_unroll.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/src/compiler/nir/nir_opt_loop_unroll.c
> b/src/compiler/nir/nir_opt_loop_unroll.c
> index a1ad0e59814..e0e0b754716 100644
> --- a/src/compiler/nir/nir_opt_loop_unroll.c
> +++ b/src/compiler/nir/nir_opt_loop_unroll.c
> @@ -575,9 +575,17 @@ nir_opt_loop_unroll_impl(nir_function_impl *impl,
>                                  &has_nested_loop);
>     }
>
> -   if (progress)
> +   if (progress) {
>        nir_lower_regs_to_ssa_impl(impl);
>
> +      /* Calling nir_convert_loop_to_lcssa() adds extra phi nodes which
> may
> +       * not be valid if they're used for something such as a deref.
> +       *  Remove any unneeded phis.
> +       */
> +      nir_copy_prop(impl->function->shader);
> +      nir_opt_remove_phis_impl(impl);
> +   }
> +
>     return progress;
>  }
>
> --
> 2.17.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180828/dba144e1/attachment.html>


More information about the mesa-dev mailing list