diff options
| -rw-r--r-- | simplify.c | 9 | ||||
| -rw-r--r-- | validation/optim/and-or-bf0.c | 1 | ||||
| -rw-r--r-- | validation/optim/and-or-constant0.c | 1 |
3 files changed, 9 insertions, 2 deletions
@@ -644,6 +644,15 @@ static int simplify_mask_or(struct instruction *insn, unsigned long long mask, s if (src2->type == PSEUDO_REG) { if ((rc = simplify_mask_or_and(insn, mask, src2, src1))) return rc; + } else if (src2->type == PSEUDO_VAL) { + unsigned long long oval = src2->value; + unsigned long long nval = oval & mask; + // Try to simplify: + // OP(OR(x, C), K) + if (nval == 0) { + // if (C & M) == 0: OR(x, C) -> x + return replace_pseudo(insn, &insn->src1, src1); + } } return 0; } diff --git a/validation/optim/and-or-bf0.c b/validation/optim/and-or-bf0.c index a17ff82d..cfaff4f2 100644 --- a/validation/optim/and-or-bf0.c +++ b/validation/optim/and-or-bf0.c @@ -17,7 +17,6 @@ void bar(struct s *p, int a) /* * check-name: and-or-bf0 * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-pattern(3): and\\. diff --git a/validation/optim/and-or-constant0.c b/validation/optim/and-or-constant0.c index e3ff0fa4..dcf440f3 100644 --- a/validation/optim/and-or-constant0.c +++ b/validation/optim/and-or-constant0.c @@ -6,7 +6,6 @@ int foo(int x) /* * check-name: and-or-constant0 * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-excludes: or\\. |
