Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ba8e3e1

Browse files
committed
Update IR
IR commit: ff7ee6c1e6090ba0ba7b47cb77939518304fab6b
1 parent a5db8b3 commit ba8e3e1

File tree

7 files changed

+86
-15
lines changed

7 files changed

+86
-15
lines changed

‎ext/opcache/jit/ir/ir.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,6 +1092,22 @@ void ir_set_op(ir_ctx *ctx, ir_ref ref, int32_t n, ir_ref val)
10921092
ir_insn_set_op(insn, n, val);
10931093
}
10941094

1095+
ir_ref ir_get_op(ir_ctx *ctx, ir_ref ref, int32_t n)
1096+
{
1097+
ir_insn *insn = &ctx->ir_base[ref];
1098+
1099+
#ifdef IR_DEBUG
1100+
if (n > 3) {
1101+
int32_t count;
1102+
1103+
IR_ASSERT(IR_OP_HAS_VAR_INPUTS(ir_op_flags[insn->op]));
1104+
count = insn->inputs_count;
1105+
IR_ASSERT(n <= count);
1106+
}
1107+
#endif
1108+
return ir_insn_op(insn, n);
1109+
}
1110+
10951111
ir_ref ir_param(ir_ctx *ctx, ir_type type, ir_ref region, const char *name, int pos)
10961112
{
10971113
return ir_emit(ctx, IR_OPT(IR_PARAM, type), region, ir_str(ctx, name), pos);
@@ -2820,6 +2836,10 @@ void _ir_VSTORE(ir_ctx *ctx, ir_ref var, ir_ref val)
28202836
}
28212837
} else if (insn->op == IR_VLOAD) {
28222838
if (insn->op2 == var) {
2839+
if (ref == val) {
2840+
/* dead STORE */
2841+
return;
2842+
}
28232843
break;
28242844
}
28252845
} else if (insn->op == IR_GUARD || insn->op == IR_GUARD_NOT) {
@@ -2910,6 +2930,10 @@ void _ir_STORE(ir_ctx *ctx, ir_ref addr, ir_ref val)
29102930
}
29112931
} else if (insn->op == IR_LOAD) {
29122932
if (insn->op2 == addr) {
2933+
if (ref == val) {
2934+
/* dead STORE */
2935+
return;
2936+
}
29132937
break;
29142938
}
29152939
type2 = insn->type;

‎ext/opcache/jit/ir/ir.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,8 @@ IR_ALWAYS_INLINE void ir_set_op3(ir_ctx *ctx, ir_ref ref, ir_ref val)
720720
ctx->ir_base[ref].op3 = val;
721721
}
722722

723+
ir_ref ir_get_op(ir_ctx *ctx, ir_ref ref, int32_t n);
724+
723725
IR_ALWAYS_INLINE ir_ref ir_insn_op(const ir_insn *insn, int32_t n)
724726
{
725727
const ir_ref *p = insn->ops + n;

‎ext/opcache/jit/ir/ir_aarch64.dasc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5247,6 +5247,14 @@ static void ir_emit_tls(ir_ctx *ctx, ir_ref def, ir_insn *insn)
52475247
| ldr Rx(reg), [Rx(reg), #insn->op2]
52485248
| ldr Rx(reg), [Rx(reg), #insn->op3]
52495249
|| }
5250+
||# elif defined(__MUSL__)
5251+
|| if (insn->op3 == IR_NULL) {
5252+
| ldr Rx(reg), [Rx(reg), #insn->op2]
5253+
|| } else {
5254+
| ldr Rx(reg), [Rx(reg), #-8]
5255+
| ldr Rx(reg), [Rx(reg), #insn->op2]
5256+
| ldr Rx(reg), [Rx(reg), #insn->op3]
5257+
|| }
52505258
||# else
52515259
||//??? IR_ASSERT(insn->op2 <= LDR_STR_PIMM64);
52525260
| ldr Rx(reg), [Rx(reg), #insn->op2]

‎ext/opcache/jit/ir/ir_cfg.c

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ IR_ALWAYS_INLINE void _ir_add_predecessors(const ir_insn *insn, ir_worklist *wor
5959

6060
int ir_build_cfg(ir_ctx *ctx)
6161
{
62-
ir_ref n, *p, ref, start, end, next;
62+
ir_ref n, *p, ref, start, end;
6363
uint32_t b;
6464
ir_insn *insn;
6565
ir_worklist worklist;
@@ -145,18 +145,8 @@ int ir_build_cfg(ir_ctx *ctx)
145145
start = ref;
146146
/* Skip control nodes untill BB end */
147147
while (1) {
148-
use_list = &ctx->use_lists[ref];
149-
n = use_list->count;
150-
next = IR_UNUSED;
151-
for (p = &ctx->use_edges[use_list->refs]; n > 0; p++, n--) {
152-
next = *p;
153-
insn = &ctx->ir_base[next];
154-
if ((ir_op_flags[insn->op] & IR_OP_FLAG_CONTROL) && insn->op1 == ref) {
155-
break;
156-
}
157-
}
158-
IR_ASSERT(next != IR_UNUSED);
159-
ref = next;
148+
ref = ir_next_control(ctx, ref);
149+
insn = &ctx->ir_base[ref];
160150
if (IR_IS_BB_END(insn->op)) {
161151
break;
162152
}

‎ext/opcache/jit/ir/ir_fold.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1513,6 +1513,34 @@ IR_FOLD(NOT(UGT))
15131513
IR_FOLD_NEXT;
15141514
}
15151515

1516+
IR_FOLD(EQ(SUB, C_U8))
1517+
IR_FOLD(EQ(SUB, C_U16))
1518+
IR_FOLD(EQ(SUB, C_U32))
1519+
IR_FOLD(EQ(SUB, C_U64))
1520+
IR_FOLD(EQ(SUB, C_I8))
1521+
IR_FOLD(EQ(SUB, C_I16))
1522+
IR_FOLD(EQ(SUB, C_I32))
1523+
IR_FOLD(EQ(SUB, C_I64))
1524+
IR_FOLD(EQ(SUB, C_ADDR))
1525+
IR_FOLD(NE(SUB, C_U8))
1526+
IR_FOLD(NE(SUB, C_U16))
1527+
IR_FOLD(NE(SUB, C_U32))
1528+
IR_FOLD(NE(SUB, C_U64))
1529+
IR_FOLD(NE(SUB, C_I8))
1530+
IR_FOLD(NE(SUB, C_I16))
1531+
IR_FOLD(NE(SUB, C_I32))
1532+
IR_FOLD(NE(SUB, C_I64))
1533+
IR_FOLD(NE(SUB, C_ADDR))
1534+
{
1535+
/* (a - b) == 0 => a == b */
1536+
if (ctx->use_lists && ctx->use_lists[op1].count == 1 && op2_insn->val.u64 == 0) {
1537+
op1 = op1_insn->op1;
1538+
op2 = op1_insn->op2;
1539+
IR_FOLD_RESTART;
1540+
}
1541+
IR_FOLD_NEXT;
1542+
}
1543+
15161544
IR_FOLD(ADD(_, C_U8))
15171545
IR_FOLD(ADD(_, C_U16))
15181546
IR_FOLD(ADD(_, C_U32))

‎ext/opcache/jit/ir/ir_private.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,25 @@ void ir_use_list_replace_all(ir_ctx *ctx, ir_ref ref, ir_ref use, ir_ref new_use
10321032
void ir_use_list_replace_one(ir_ctx *ctx, ir_ref ref, ir_ref use, ir_ref new_use);
10331033
bool ir_use_list_add(ir_ctx *ctx, ir_ref to, ir_ref new_use);
10341034

1035+
IR_ALWAYS_INLINE ir_ref ir_next_control(const ir_ctx *ctx, ir_ref ref)
1036+
{
1037+
ir_use_list *use_list = &ctx->use_lists[ref];
1038+
ir_ref n = use_list->count;
1039+
ir_ref *p;
1040+
1041+
IR_ASSERT(ir_op_flags[ctx->ir_base[ref].op] & IR_OP_FLAG_CONTROL);
1042+
for (p = &ctx->use_edges[use_list->refs]; n > 0; p++, n--) {
1043+
ir_ref next = *p;
1044+
ir_insn *insn = &ctx->ir_base[next];
1045+
1046+
if ((ir_op_flags[insn->op] & IR_OP_FLAG_CONTROL) && insn->op1 == ref) {
1047+
return next;
1048+
}
1049+
}
1050+
IR_ASSERT(0);
1051+
return IR_UNUSED;
1052+
}
1053+
10351054
/*** Modification helpers ***/
10361055
#define MAKE_NOP(_insn) do { \
10371056
ir_insn *__insn = _insn; \

‎ext/opcache/jit/ir/ir_sccp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2213,7 +2213,7 @@ int ir_sccp(ir_ctx *ctx)
22132213
if (!may_benefit) {
22142214
IR_MAKE_BOTTOM(i);
22152215
if (insn->op == IR_FP2FP || insn->op == IR_FP2INT || insn->op == IR_TRUNC
2216-
|| insn->op == IR_ZEXT || insn->op == IR_SEXT) {
2216+
|| insn->op == IR_ZEXT || insn->op == IR_SEXT||insn->op==IR_EQ||insn->op==IR_NE) {
22172217
ir_bitqueue_add(&worklist2, i);
22182218
}
22192219
} else if (!ir_sccp_fold(ctx, _values, i, insn->opt, insn->op1, insn->op2, insn->op3)) {
@@ -2222,7 +2222,7 @@ int ir_sccp(ir_ctx *ctx)
22222222
} else if (_values[i].optx == IR_BOTTOM) {
22232223
insn = &ctx->ir_base[i];
22242224
if (insn->op == IR_FP2FP || insn->op == IR_FP2INT || insn->op == IR_TRUNC
2225-
|| insn->op == IR_ZEXT || insn->op == IR_SEXT) {
2225+
|| insn->op == IR_ZEXT || insn->op == IR_SEXT||insn->op==IR_EQ||insn->op==IR_NE) {
22262226
ir_bitqueue_add(&worklist2, i);
22272227
}
22282228
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /