Commit d96878a6 authored by Jason Ekstrand's avatar Jason Ekstrand

nir/propagate_invariant: Don't add NULL vars to the hash table

Fixes: 8410cf66 "nir/propagate_invariant: Skip unknown vars"
Reviewed-by: Kenneth Graunke's avatarKenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Caio Marcelo de Oliveira Filho's avatarCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Eric Anholt's avatarEric Anholt <eric@anholt.net>
parent 1c30d26d
......@@ -65,12 +65,21 @@ add_cf_node(nir_cf_node *cf, struct set *invariants)
static void
add_var(nir_variable *var, struct set *invariants)
{
_mesa_set_add(invariants, var);
/* Because we pass the result of nir_intrinsic_get_var directly to this
* function, it's possible for var to be NULL if, for instance, there's a
* cast somewhere in the chain.
*/
if (var != NULL)
_mesa_set_add(invariants, var);
}
static bool
var_is_invariant(nir_variable *var, struct set * invariants)
{
/* Because we pass the result of nir_intrinsic_get_var directly to this
* function, it's possible for var to be NULL if, for instance, there's a
* cast somewhere in the chain.
*/
return var && (var->data.invariant || _mesa_set_search(invariants, var));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment