[Mesa-dev] [PATCH] nir: use common deref has indirect code in scratch lowering.
Jason Ekstrand
jason at jlekstrand.net
Wed Jul 31 18:59:15 UTC 2019
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
The only real difference is that the common one also handles casts. Would
probably be good to handle them here too.
--Jason
On Wed, Jul 31, 2019 at 12:36 AM Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> This doesn't seem to need it's own copy here.
> ---
> src/compiler/nir/nir_lower_scratch.c | 16 +---------------
> 1 file changed, 1 insertion(+), 15 deletions(-)
>
> diff --git a/src/compiler/nir/nir_lower_scratch.c
> b/src/compiler/nir/nir_lower_scratch.c
> index df0d3f43124..aacc2ddca08 100644
> --- a/src/compiler/nir/nir_lower_scratch.c
> +++ b/src/compiler/nir/nir_lower_scratch.c
> @@ -34,20 +34,6 @@
> #include "nir_builder.h"
> #include "nir_deref.h"
>
> -static bool
> -deref_has_indirect(nir_deref_instr *deref)
> -{
> - while (deref->deref_type != nir_deref_type_var) {
> - if (deref->deref_type == nir_deref_type_array &&
> - nir_src_as_const_value(deref->arr.index) == NULL)
> - return true;
> -
> - deref = nir_deref_instr_parent(deref);
> - }
> -
> - return false;
> -}
> -
> static void
> lower_load_store(nir_builder *b,
> nir_intrinsic_instr *intrin,
> @@ -128,7 +114,7 @@ nir_lower_vars_to_scratch(nir_shader *shader,
> if (!(deref->mode & modes))
> continue;
>
> - if (!deref_has_indirect(nir_src_as_deref(intrin->src[0])))
> + if
> (!nir_deref_instr_has_indirect(nir_src_as_deref(intrin->src[0])))
> continue;
>
> nir_variable *var = nir_deref_instr_get_variable(deref);
> --
> 2.21.0
>
> _______________________________________________
> 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/20190731/70cacb01/attachment.html>
More information about the mesa-dev
mailing list