Skip to content

Commit 6896756

Browse files
committed
Update IR
IR commit: abbdbf2ad7f66b02106f3b51602a21f10f508808
1 parent 951dab7 commit 6896756

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

ext/opcache/jit/ir/ir_gcm.c

+19
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,25 @@ static uint32_t ir_gcm_select_best_block(ir_ctx *ctx, ir_ref ref, uint32_t lca)
112112
bb = &ctx->cfg_blocks[b];
113113
if (bb->loop_depth < loop_depth) {
114114
if (!bb->loop_depth) {
115+
#if 1
116+
/* Avoid LICM if LOOP doesn't have a pre-header block */
117+
ir_block *loop_bb = &ctx->cfg_blocks[best];
118+
119+
if (!(loop_bb->flags & IR_BB_LOOP_HEADER)) {
120+
loop_bb = &ctx->cfg_blocks[loop_bb->loop_header];
121+
}
122+
if (loop_bb->predecessors_count > 2) {
123+
int n = loop_bb->predecessors_count;
124+
uint32_t *p = ctx->cfg_edges + loop_bb->predecessors;
125+
126+
while (n && *p != b) {
127+
n--; p++;
128+
}
129+
if (!n) {
130+
break;
131+
}
132+
}
133+
#endif
115134
best = b;
116135
break;
117136
}

0 commit comments

Comments
 (0)