diff options
-rw-r--r-- | simplify.c | 11 | ||||
-rw-r--r-- | validation/optim/range-check1.c | 1 | ||||
-rw-r--r-- | validation/optim/range-check2.c | 1 |
3 files changed, 11 insertions, 2 deletions
@@ -1920,6 +1920,17 @@ static int simplify_and_one_side(struct instruction *insn, pseudo_t *p1, pseudo_ if (def->src1 == defr->src1 && def->src2 == defr->src2) return replace_with_value(insn, 0); } + if (def->opcode == OP_SET_GE && is_zero(def->src2)) { + switch (DEF_OPCODE(defr, *p2)) { + case OP_SET_LE: + if (!is_positive(defr->src2, defr->itype->bit_size)) + break; + // (x >= 0) && (x <= C) --> (x u<= C) + insn->itype = defr->itype; + replace_binop(insn, OP_SET_BE, &insn->src1, defr->src1, &insn->src2, defr->src2); + return REPEAT_CSE; + } + } break; case OP_OR: if (DEF_OPCODE(defr, *p2) == OP_OR) { diff --git a/validation/optim/range-check1.c b/validation/optim/range-check1.c index 82b93991..358da045 100644 --- a/validation/optim/range-check1.c +++ b/validation/optim/range-check1.c @@ -8,7 +8,6 @@ _Bool check_ok(long i) /* * check-name: range-check1 * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-contains: setbe\\..*0x3ff diff --git a/validation/optim/range-check2.c b/validation/optim/range-check2.c index f565b84e..69c01b9d 100644 --- a/validation/optim/range-check2.c +++ b/validation/optim/range-check2.c @@ -8,7 +8,6 @@ _Bool check_ok(int i) /* * check-name: range-check2 * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-returns: 1 |