[Mesa-dev] [PATCH 3/3] nir: handle shared pointers in lowering indirect derefs.

Jason Ekstrand jason at jlekstrand.net
Mon Nov 19 19:29:26 UTC 2018


On Sun, Nov 18, 2018 at 9:57 PM Dave Airlie <airlied at gmail.com> wrote:

> From: Dave Airlie <airlied at redhat.com>
>
> Check if the base ends up with no variable, and continue
> if we see that case outside the loop.
> ---
>  src/compiler/nir/nir_lower_indirect_derefs.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/src/compiler/nir/nir_lower_indirect_derefs.c
> b/src/compiler/nir/nir_lower_indirect_derefs.c
> index 897a0620872..3d6452ac847 100644
> --- a/src/compiler/nir/nir_lower_indirect_derefs.c
> +++ b/src/compiler/nir/nir_lower_indirect_derefs.c
> @@ -141,8 +141,12 @@ lower_indirect_derefs_block(nir_block *block,
> nir_builder *b,
>              has_indirect = true;
>
>           base = nir_deref_instr_parent(base);
> +         if (base == NULL)
> +            break;
>        }
>
> +      if (base == NULL)
> +         continue;
>        if (!has_indirect)
>

My version of this patch did "while (base &&" and "if (!base ||
!has_indirect)" which makes the code a bit smaller.  Doesn't matter much.
Either way,

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


>           continue;
>
> --
> 2.17.2
>
> _______________________________________________
> 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/20181119/50d424d9/attachment.html>


More information about the mesa-dev mailing list