nir: use common deref has indirect code in scratch lowering.
authorDave Airlie <airlied@redhat.com>
Wed, 31 Jul 2019 04:05:49 +0000 (14:05 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 31 Jul 2019 22:32:12 +0000 (08:32 +1000)
This doesn't seem to need it's own copy here.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
src/compiler/nir/nir_lower_scratch.c

index df0d3f43124aec73873db703b3b4c4d2783e8335..aacc2ddca08934786cb6b05b3c8ad97e6160f4c4 100644 (file)
 #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);