Removed wrong code selection rule

This commit is contained in:
Dmitry Stogov 2023-05-11 12:47:49 +03:00
parent 6f8aa7b540
commit 842f97cbcb

View File

@ -1743,20 +1743,10 @@ store_int:
} else { } else {
ir_match_fuse_load(ctx, op1_insn->op2, ref); ir_match_fuse_load(ctx, op1_insn->op2, ref);
} }
if (op1_insn->op == IR_AND && ctx->use_lists[op2_insn->op1].count == 1) { /* v = BINOP(_, _); c = CMP(v, 0) ... IF(c) => BINOP; SKIP_CMP ... GUARD_JCC */
/* v = AND(_, _); c = CMP(v, 0) ... IF(c) => SKIP_TEST; SKIP ... GUARD_TEST */ ctx->rules[op2_insn->op1] = IR_BINOP_INT;
if (IR_IS_CONST_REF(op1_insn->op2)) { ctx->rules[insn->op2] = IR_FUSED | IR_CMP_INT;
ir_match_fuse_load(ctx, op1_insn->op1, ref); return IR_GUARD_JCC_INT;
}
ctx->rules[op2_insn->op1] = IR_FUSED | IR_TEST_INT;
ctx->rules[insn->op2] = IR_FUSED | IR_SIMPLE | IR_NOP;
return IR_GUARD_TEST_INT;
} else {
/* v = BINOP(_, _); c = CMP(v, 0) ... IF(c) => BINOP; SKIP_CMP ... GUARD_JCC */
ctx->rules[op2_insn->op1] = IR_BINOP_INT;
ctx->rules[insn->op2] = IR_FUSED | IR_CMP_INT;
return IR_GUARD_JCC_INT;
}
} }
} else if ((ctx->flags & IR_OPT_CODEGEN) } else if ((ctx->flags & IR_OPT_CODEGEN)
&& op2_insn->op1 == insn->op2 - 2 /* before previous instruction */ && op2_insn->op1 == insn->op2 - 2 /* before previous instruction */