Mesa (master): nir/large_constants: Use ralloc for var_infos

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 18 19:43:54 UTC 2019


Module: Mesa
Branch: master
Commit: d9b67ad0796612620b82b7ea11a720735ce7df3f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d9b67ad0796612620b82b7ea11a720735ce7df3f

Author: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Date:   Fri Jun  7 09:21:09 2019 -0700

nir/large_constants: Use ralloc for var_infos

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 at jlekstrand.net>

---

 src/compiler/nir/nir_opt_large_constants.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/compiler/nir/nir_opt_large_constants.c b/src/compiler/nir/nir_opt_large_constants.c
index 09361a0099d..3d988557ef2 100644
--- a/src/compiler/nir/nir_opt_large_constants.c
+++ b/src/compiler/nir/nir_opt_large_constants.c
@@ -159,7 +159,7 @@ nir_opt_large_constants(nir_shader *shader,
    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,
@@ -263,7 +263,7 @@ nir_opt_large_constants(nir_shader *shader,
    }
 
    if (shader->constant_data_size == 0) {
-      free(var_infos);
+      ralloc_free(var_infos);
       return false;
    }
 
@@ -343,7 +343,7 @@ nir_opt_large_constants(nir_shader *shader,
          exec_node_remove(&var->node);
    }
 
-   free(var_infos);
+   ralloc_free(var_infos);
 
    nir_metadata_preserve(impl, nir_metadata_block_index |
                                nir_metadata_dominance);




More information about the mesa-commit mailing list