This will be used later on to allocate constant data for each
variable (and then deduplicate). Also drop initializing found_read,
as it is already implicitly false in the literal.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
if (num_locals == 0)
return false;
- struct var_info *var_infos = malloc(num_locals * sizeof(struct var_info));
+ struct var_info *var_infos = ralloc_array(NULL, struct var_info, num_locals);
for (unsigned i = 0; i < num_locals; i++) {
var_infos[i] = (struct var_info) {
.is_constant = true,
}
if (shader->constant_data_size == 0) {
- free(var_infos);
+ ralloc_free(var_infos);
return false;
}
exec_node_remove(&var->node);
}
- free(var_infos);
+ ralloc_free(var_infos);
nir_metadata_preserve(impl, nir_metadata_block_index |
nir_metadata_dominance);