aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
-rw-r--r--simplify.c8
-rw-r--r--validation/optim/and-or-bf1.c1
-rw-r--r--validation/optim/and-or-lsr1.c1
-rw-r--r--validation/optim/and-or-mask1.c1
4 files changed, 8 insertions, 3 deletions
diff --git a/simplify.c b/simplify.c
index c12655d1..e2e51633 100644
--- a/simplify.c
+++ b/simplify.c
@@ -605,6 +605,14 @@ static int simplify_mask_or_and(struct instruction *insn, unsigned long long mas
// if (M' & M) == 0: ((a & M') | b) -> b
return replace_pseudo(insn, &insn->src1, orb);
}
+ if (multi_users(insn->src1))
+ return 0; // can't modify anything inside the OR
+ if (nmask == mask) {
+ struct instruction *or = insn->src1->def;
+ pseudo_t *arg = (ora == or->src1) ? &or->src1 : &or->src2;
+ // if (M' & M) == M: ((a & M') | b) -> (a | b)
+ return replace_pseudo(or, arg, and->src1);
+ }
return 0;
}
diff --git a/validation/optim/and-or-bf1.c b/validation/optim/and-or-bf1.c
index d20f1cb7..23477ff3 100644
--- a/validation/optim/and-or-bf1.c
+++ b/validation/optim/and-or-bf1.c
@@ -11,7 +11,6 @@ void foo(struct s *d, const struct s *s, int a)
/*
* check-name: and-or-bf1
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
*
* check-output-ignore
* check-output-pattern(2): and\\.
diff --git a/validation/optim/and-or-lsr1.c b/validation/optim/and-or-lsr1.c
index 4806d7bc..bd1dbc8a 100644
--- a/validation/optim/and-or-lsr1.c
+++ b/validation/optim/and-or-lsr1.c
@@ -6,7 +6,6 @@ int foo(int a, int b)
/*
* check-name: and-or-lsr1
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
*
* check-output-ignore
* check-output-pattern(0): and\\.
diff --git a/validation/optim/and-or-mask1.c b/validation/optim/and-or-mask1.c
index f86e0565..bff3a89f 100644
--- a/validation/optim/and-or-mask1.c
+++ b/validation/optim/and-or-mask1.c
@@ -6,7 +6,6 @@ int foo(int a, int b)
/*
* check-name: and-or-mask1
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
*
* check-output-ignore
* check-output-pattern(1): and\\.