Skip to content

Commit

Permalink
Update IR
Browse files Browse the repository at this point in the history
IR commit: 87cba9af675afd2ca20cbaab397ad1c83d700475
  • Loading branch information
dstogov committed Mar 26, 2024
1 parent 6316eb1 commit 9fae55f
Show file tree
Hide file tree
Showing 5 changed files with 505 additions and 120 deletions.
15 changes: 15 additions & 0 deletions ext/opcache/jit/ir/ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1984,10 +1984,25 @@ void _ir_BEGIN(ir_ctx *ctx, ir_ref src)
}
}

ir_ref _ir_fold_condition(ir_ctx *ctx, ir_ref ref)
{
ir_insn *insn = &ctx->ir_base[ref];

if (insn->op == IR_NE && IR_IS_CONST_REF(insn->op2)) {
ir_insn *op2_insn = &ctx->ir_base[insn->op2];

if (IR_IS_TYPE_INT(op2_insn->type) && op2_insn->val.u64 == 0) {
return insn->op1;
}
}
return ref;
}

ir_ref _ir_IF(ir_ctx *ctx, ir_ref condition)
{
ir_ref if_ref;

condition = _ir_fold_condition(ctx, condition);
IR_ASSERT(ctx->control);
if (IR_IS_CONST_REF(condition)) {
condition = ir_ref_is_true(ctx, condition) ? IR_TRUE : IR_FALSE;
Expand Down
5 changes: 3 additions & 2 deletions ext/opcache/jit/ir/ir.h
Original file line number Diff line number Diff line change
Expand Up @@ -531,8 +531,9 @@ void ir_strtab_free(ir_strtab *strtab);

/* debug related */
#ifdef IR_DEBUG
# define IR_DEBUG_SCCP (1<<27)
# define IR_DEBUG_GCM (1<<28)
# define IR_DEBUG_SCCP (1<<26)
# define IR_DEBUG_GCM (1<<27)
# define IR_DEBUG_GCM_SPLIT (1<<28)
# define IR_DEBUG_SCHEDULE (1<<29)
# define IR_DEBUG_RA (1<<30)
#endif
Expand Down
Loading

0 comments on commit 9fae55f

Please sign in to comment.