Skip to content

Commit 5ed438f

Browse files
committed
Update IR
IR commit: 673308a039eed5a2fdf4a2783b3dd3d6010a8c19
1 parent d17ed34 commit 5ed438f

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

ext/opcache/jit/ir/ir.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,7 +1176,7 @@ void ir_build_def_use_lists(ir_ctx *ctx)
11761176
use_list->count = 0;
11771177
}
11781178

1179-
edges = ir_mem_malloc(edges_count * sizeof(ir_ref));
1179+
edges = ir_mem_malloc(IR_ALIGNED_SIZE(edges_count * sizeof(ir_ref), 4096));
11801180
for (i = IR_UNUSED + 1, insn = ctx->ir_base + i; i < ctx->insns_count;) {
11811181
n = insn->inputs_count;
11821182
for (j = n, p = insn->ops + 1; j > 0; j--, p++) {
@@ -1245,7 +1245,7 @@ void ir_build_def_use_lists(ir_ctx *ctx)
12451245
}
12461246

12471247
ctx->use_edges_count = edges_count;
1248-
edges = ir_mem_malloc(edges_count * sizeof(ir_ref));
1248+
edges = ir_mem_malloc(IR_ALIGNED_SIZE(edges_count * sizeof(ir_ref), 4096));
12491249
for (use_list = lists + ctx->insns_count - 1; use_list != lists; use_list--) {
12501250
n = use_list->refs;
12511251
if (n) {
@@ -1356,8 +1356,13 @@ bool ir_use_list_add(ir_ctx *ctx, ir_ref to, ir_ref ref)
13561356
use_list->count++;
13571357
return 0;
13581358
} else {
1359-
/* Reallocate the whole edges buffer (this is inefficient) */
1360-
ctx->use_edges = ir_mem_realloc(ctx->use_edges, (ctx->use_edges_count + use_list->count + 1) * sizeof(ir_ref));
1359+
size_t old_size = IR_ALIGNED_SIZE(ctx->use_edges_count * sizeof(ir_ref), 4096);
1360+
size_t new_size = IR_ALIGNED_SIZE((ctx->use_edges_count + use_list->count + 1) * sizeof(ir_ref), 4096);
1361+
1362+
if (old_size < new_size) {
1363+
/* Reallocate the whole edges buffer (this is inefficient) */
1364+
ctx->use_edges = ir_mem_realloc(ctx->use_edges, new_size);
1365+
}
13611366
memcpy(ctx->use_edges + ctx->use_edges_count, ctx->use_edges + use_list->refs, use_list->count * sizeof(ir_ref));
13621367
use_list->refs = ctx->use_edges_count;
13631368
ctx->use_edges[use_list->refs + use_list->count] = ref;

ext/opcache/jit/ir/ir_emit.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,9 @@ static int ir_parallel_copy(ir_ctx *ctx, ir_copy *copies, int count, ir_reg tmp_
566566
if (IR_IS_TYPE_INT(type)) {
567567
#ifdef IR_HAVE_SWAP_INT
568568
if (pred[from] == to) {
569+
if (ir_type_size[types[to]] > ir_type_size[type]) {
570+
type = types[to];
571+
}
569572
ir_emit_swap(ctx, type, to, from);
570573
IR_REGSET_EXCL(todo, from);
571574
loc[to] = from;
@@ -579,7 +582,7 @@ static int ir_parallel_copy(ir_ctx *ctx, ir_copy *copies, int count, ir_reg tmp_
579582
loc[to] = tmp_reg;
580583
} else {
581584
#ifdef IR_HAVE_SWAP_FP
582-
if (pred[from] == to) {
585+
if (pred[from] == to && types[to] == type) {
583586
ir_emit_swap_fp(ctx, type, to, from);
584587
IR_REGSET_EXCL(todo, from);
585588
loc[to] = from;

0 commit comments

Comments
 (0)