aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-08-12 11:56:52 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-08-22 09:25:34 +0200
commit8ef6a1d0cac7fdbf5f0c0f70f5c3a25cc1e88670 (patch)
treec0fd4b8e050b83bde8ef113560d7d44371fe0c3d /validation
parent4bcb69f986bc4e584cf47c0bafcaa95eafe8e710 (diff)
downloadsparse-dev-8ef6a1d0cac7fdbf5f0c0f70f5c3a25cc1e88670.tar.gz
simplify OP((x | C), K) when (C & M) == M
In an expression like OP((x | C), K), if the effective mask (M) corresponding to OP(_, K) is equal to the combined mask (C & M), then the OR operation is unneeded and can be replaced by M itself, giving: OP(M, K). In mathematical terms: 0) ((x | C) & M) = ((x & M) | (C & M)) 1) (C & M) = M 2) ((x & M) | (C & M)) = ((x & M) | M) = M and so OP((x | C), K) -> OP(M, K). For example, code like: unsigned int foo(int x) { return (x | 7) & 2; } is now simplified into: foo: ret.32 $2 which previously was not optimized foo: or.32 %r2 <- %arg1, $7 and.32 %r3 <- %r2, $2 ret.32 %r3 Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
-rw-r--r--validation/optim/and-or-constant1.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/validation/optim/and-or-constant1.c b/validation/optim/and-or-constant1.c
index 3f1c9052..49823d5c 100644
--- a/validation/optim/and-or-constant1.c
+++ b/validation/optim/and-or-constant1.c
@@ -6,7 +6,6 @@ int foo(int x)
/*
* check-name: or-and-constant1
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
*
* check-output-ignore
* check-output-contains: ret\\..*\\$0xfff