mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-02 23:09:05 +02:00
nir/propagate_invariant: Don't add NULL vars to the hash table
Fixes:8410cf66d"nir/propagate_invariant: Skip unknown vars" Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com> Reviewed-by: Eric Anholt <eric@anholt.net> (cherry picked from commitd96878a66a)
This commit is contained in:
parent
90623adb16
commit
1f40ef24cc
1 changed files with 10 additions and 1 deletions
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue