Reuse ir_ctx.prev_ref if the schedule wasn't changed

This commit is contained in:
Dmitry Stogov 2022-11-23 16:30:29 +03:00
parent bdb8e6a1da
commit 6f8012756e

View File

@ -540,10 +540,6 @@ restart:
}
#endif
ir_mem_free(_prev);
/* TODO: linearize without reallocation and reconstruction ??? */
#if 1
if (consts_count == ctx->consts_count && insns_count == ctx->insns_count) {
bool changed = 0;
@ -561,6 +557,7 @@ restart:
ir_mem_free(_xlat);
ir_mem_free(_next);
ctx->prev_ref = _prev;
ctx->flags |= IR_LINEAR;
ir_truncate(ctx);
@ -569,6 +566,8 @@ restart:
}
#endif
ir_mem_free(_prev);
ir_init(&new_ctx, consts_count, insns_count);
new_ctx.insns_count = insns_count;
new_ctx.flags = ctx->flags;