Replace calloc() by malloc()

This commit is contained in:
Dmitry Stogov 2022-09-15 11:57:01 +03:00
parent b344d2ee0f
commit dce017f0ed
2 changed files with 6 additions and 3 deletions

View File

@ -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 /* 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. */ * queries. These are implemented by checking entry/exit times of the DFS search. */
ir_worklist_init(&work, ctx->cfg_blocks_count + 1); 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; exit_times = entry_times + ctx->cfg_blocks_count + 1;
sorted_blocks = exit_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); ir_worklist_push(&work, 1);
while (ir_worklist_len(&work)) { while (ir_worklist_len(&work)) {
ir_block *bb; ir_block *bb;
@ -694,8 +696,9 @@ int ir_schedule_blocks(ir_ctx *ctx)
} }
if (reorder) { 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++) { for (b = 1, bb = cfg_blocks + 1; b <= count; b++, bb++) {
*bb = ctx->cfg_blocks[list[b]]; *bb = ctx->cfg_blocks[list[b]];
if (bb->dom_parent > 0) { if (bb->dom_parent > 0) {

View File

@ -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) 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; a->size = size;
} }