nir: zero allocated memory where needed
authorJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Tue, 11 Oct 2016 10:54:58 +0000 (13:54 +0300)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 31 Oct 2016 10:53:38 +0000 (11:53 +0100)
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
src/compiler/nir/nir.c
src/compiler/nir/nir_opt_dce.c
src/compiler/nir/nir_phi_builder.c
src/compiler/nir/nir_search.c
src/compiler/nir/nir_to_ssa.c
src/compiler/nir/nir_worklist.c

index 09aad57e87f81c5d20d79a76cbf3d26cf172b070..31f0bcb8d81908c315474873f5cd1bf8bd910355 100644 (file)
@@ -35,7 +35,7 @@ nir_shader_create(void *mem_ctx,
                   const nir_shader_compiler_options *options,
                   shader_info *si)
 {
-   nir_shader *shader = ralloc(mem_ctx, nir_shader);
+   nir_shader *shader = rzalloc(mem_ctx, nir_shader);
 
    exec_list_make_empty(&shader->uniforms);
    exec_list_make_empty(&shader->inputs);
@@ -336,7 +336,7 @@ nir_function_impl_create(nir_function *function)
 nir_block *
 nir_block_create(nir_shader *shader)
 {
-   nir_block *block = ralloc(shader, nir_block);
+   nir_block *block = rzalloc(shader, nir_block);
 
    cf_init(&block->cf_node, nir_cf_node_block);
 
index 0aeb08a320db9e95fe2f9adeada4edd248ac2a2c..5cefba3a7203c439e04eed7a5f68502e7a90c5f9 100644 (file)
@@ -131,7 +131,7 @@ init_block(nir_block *block, struct exec_list *worklist)
 static bool
 nir_opt_dce_impl(nir_function_impl *impl)
 {
-   struct exec_list *worklist = ralloc(NULL, struct exec_list);
+   struct exec_list *worklist = rzalloc(NULL, struct exec_list);
    exec_list_make_empty(worklist);
 
    nir_foreach_block(block, impl) {
index f96dad78dd855eb1e682c77bbed27571a478d52f..6b4b69399178ca48c6757b339fba2c7903728e37 100644 (file)
@@ -81,7 +81,7 @@ struct nir_phi_builder_value {
 struct nir_phi_builder *
 nir_phi_builder_create(nir_function_impl *impl)
 {
-   struct nir_phi_builder *pb = ralloc(NULL, struct nir_phi_builder);
+   struct nir_phi_builder *pb = rzalloc(NULL, struct nir_phi_builder);
 
    pb->shader = impl->function->shader;
    pb->impl = impl;
index f24a7b9d07fedc3eab2c6e2baffb66d55b63c06b..b34b13fdb8904bd47fbfbf90108fe9244759b410 100644 (file)
@@ -340,7 +340,7 @@ static bitsize_tree *
 build_bitsize_tree(void *mem_ctx, struct match_state *state,
                    const nir_search_value *value)
 {
-   bitsize_tree *tree = ralloc(mem_ctx, bitsize_tree);
+   bitsize_tree *tree = rzalloc(mem_ctx, bitsize_tree);
 
    switch (value->type) {
    case nir_search_value_expression: {
index 6accdd24b3fb9ccc97d04cfea6c0f94702ad8aaa..e0998d4bb01c8a4fea593c2a60a78c9a529b9070 100644 (file)
@@ -476,7 +476,7 @@ init_rewrite_state(nir_function_impl *impl, rewrite_state *state)
    state->mem_ctx = ralloc_parent(impl);
    state->ssa_map = _mesa_hash_table_create(NULL, _mesa_hash_pointer,
                                             _mesa_key_pointer_equal);
-   state->states = ralloc_array(NULL, reg_state, impl->reg_alloc);
+   state->states = rzalloc_array(NULL, reg_state, impl->reg_alloc);
 
    foreach_list_typed(nir_register, reg, node, &impl->registers) {
       assert(reg->index < impl->reg_alloc);
index 3ae2770288b446c41a36866be3d72ee535d9bf4c..75e9426daeef9dea83448090f57eb00d9ac811f1 100644 (file)
@@ -37,7 +37,7 @@ nir_block_worklist_init(nir_block_worklist *w, unsigned num_blocks,
 
    w->blocks_present = rzalloc_array(mem_ctx, BITSET_WORD,
                                      BITSET_WORDS(num_blocks));
-   w->blocks = ralloc_array(mem_ctx, nir_block *, num_blocks);
+   w->blocks = rzalloc_array(mem_ctx, nir_block *, num_blocks);
 }
 
 void