Skip to content

Commit 9fae55f

Browse files
committed
Update IR
IR commit: 87cba9af675afd2ca20cbaab397ad1c83d700475
1 parent 6316eb1 commit 9fae55f

File tree

5 files changed

+505
-120
lines changed

5 files changed

+505
-120
lines changed

ext/opcache/jit/ir/ir.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1984,10 +1984,25 @@ void _ir_BEGIN(ir_ctx *ctx, ir_ref src)
19841984
}
19851985
}
19861986

1987+
ir_ref _ir_fold_condition(ir_ctx *ctx, ir_ref ref)
1988+
{
1989+
ir_insn *insn = &ctx->ir_base[ref];
1990+
1991+
if (insn->op == IR_NE && IR_IS_CONST_REF(insn->op2)) {
1992+
ir_insn *op2_insn = &ctx->ir_base[insn->op2];
1993+
1994+
if (IR_IS_TYPE_INT(op2_insn->type) && op2_insn->val.u64 == 0) {
1995+
return insn->op1;
1996+
}
1997+
}
1998+
return ref;
1999+
}
2000+
19872001
ir_ref _ir_IF(ir_ctx *ctx, ir_ref condition)
19882002
{
19892003
ir_ref if_ref;
19902004

2005+
condition = _ir_fold_condition(ctx, condition);
19912006
IR_ASSERT(ctx->control);
19922007
if (IR_IS_CONST_REF(condition)) {
19932008
condition = ir_ref_is_true(ctx, condition) ? IR_TRUE : IR_FALSE;

ext/opcache/jit/ir/ir.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,9 @@ void ir_strtab_free(ir_strtab *strtab);
531531

532532
/* debug related */
533533
#ifdef IR_DEBUG
534-
# define IR_DEBUG_SCCP (1<<27)
535-
# define IR_DEBUG_GCM (1<<28)
534+
# define IR_DEBUG_SCCP (1<<26)
535+
# define IR_DEBUG_GCM (1<<27)
536+
# define IR_DEBUG_GCM_SPLIT (1<<28)
536537
# define IR_DEBUG_SCHEDULE (1<<29)
537538
# define IR_DEBUG_RA (1<<30)
538539
#endif

0 commit comments

Comments
 (0)