nir: Handle complex derefs in nir_split_array_vars
authorJason Ekstrand <jason@jlekstrand.net>
Fri, 30 Aug 2019 18:21:00 +0000 (13:21 -0500)
committerJason Ekstrand <jason@jlekstrand.net>
Fri, 6 Sep 2019 23:39:01 +0000 (23:39 +0000)
We already bail and don't split the vars but we were passing a NULL to
_mesa_hash_table_search which is not allowed.

Fixes: f1cb3348f1 "nir/split_vars: Properly bail in the presence of ..."
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
src/compiler/nir/nir_split_vars.c

index 3d98b5c8805fbea9db7a0ddf7e7243b33e38c120..80536ac543a58bf6bb37c768970d8ad32a99b7af 100644 (file)
@@ -427,8 +427,11 @@ get_array_deref_info(nir_deref_instr *deref,
    if (!(deref->mode & modes))
       return NULL;
 
-   return get_array_var_info(nir_deref_instr_get_variable(deref),
-                             var_info_map);
+   nir_variable *var = nir_deref_instr_get_variable(deref);
+   if (var == NULL)
+      return NULL;
+
+   return get_array_var_info(var, var_info_map);
 }
 
 static void