aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
-rw-r--r--simplify.c4
-rw-r--r--validation/optim/and-or-constant2.c1
2 files changed, 4 insertions, 1 deletions
diff --git a/simplify.c b/simplify.c
index a8f4d7fe..8b56df4b 100644
--- a/simplify.c
+++ b/simplify.c
@@ -657,6 +657,10 @@ static int simplify_mask_or(struct instruction *insn, unsigned long long mask, s
// if (C & M) == M: OR(x, C) -> M
return replace_pseudo(insn, &insn->src1, value_pseudo(mask));
}
+ if (nval != oval && !multi_users(or->target)) {
+ // if (C & M) != C: OR(x, C) -> OR(x, (C & M))
+ return replace_pseudo(or, &or->src2, value_pseudo(nval));
+ }
}
return 0;
}
diff --git a/validation/optim/and-or-constant2.c b/validation/optim/and-or-constant2.c
index 82e0d3c6..d7e66f9c 100644
--- a/validation/optim/and-or-constant2.c
+++ b/validation/optim/and-or-constant2.c
@@ -6,7 +6,6 @@ int foo(int x)
/*
* check-name: and-or-constant2
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
*
* check-output-ignore
* check-output-contains: or\\..*\\$0xff0