diff --git a/ir_cfg.c b/ir_cfg.c index 69945a2..39ffc0a 100644 --- a/ir_cfg.c +++ b/ir_cfg.c @@ -430,10 +430,12 @@ int ir_find_loops(ir_ctx *ctx) /* We don't materialize the DJ spanning tree explicitly, as we are only interested in ancestor * queries. These are implemented by checking entry/exit times of the DFS search. */ ir_worklist_init(&work, ctx->cfg_blocks_count + 1); - entry_times = ir_mem_calloc((ctx->cfg_blocks_count + 1) * 3, sizeof(uint32_t)); + entry_times = ir_mem_malloc((ctx->cfg_blocks_count + 1) * 3 * sizeof(uint32_t)); exit_times = entry_times + ctx->cfg_blocks_count + 1; sorted_blocks = exit_times + ctx->cfg_blocks_count + 1; + memset(entry_times, 0, (ctx->cfg_blocks_count + 1) * sizeof(uint32_t)); + ir_worklist_push(&work, 1); while (ir_worklist_len(&work)) { ir_block *bb; @@ -694,8 +696,9 @@ int ir_schedule_blocks(ir_ctx *ctx) } if (reorder) { - ir_block *cfg_blocks = ir_mem_calloc(sizeof(ir_block), ctx->cfg_blocks_count + 1); + ir_block *cfg_blocks = ir_mem_malloc(sizeof(ir_block) * (ctx->cfg_blocks_count + 1)); + memset(ctx->cfg_blocks, 0, sizeof(ir_block)); for (b = 1, bb = cfg_blocks + 1; b <= count; b++, bb++) { *bb = ctx->cfg_blocks[list[b]]; if (bb->dom_parent > 0) { diff --git a/ir_private.h b/ir_private.h index 0ec5b69..a05a8bd 100644 --- a/ir_private.h +++ b/ir_private.h @@ -449,7 +449,7 @@ void ir_array_remove(ir_array *a, uint32_t i); IR_ALWAYS_INLINE void ir_array_init(ir_array *a, uint32_t size) { - a->refs = ir_mem_calloc(size, sizeof(ir_ref)); + a->refs = ir_mem_malloc(size * sizeof(ir_ref)); a->size = size; }