summaryrefslogtreecommitdiff
path: root/test/Transforms/InstSimplify
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2010-12-22 17:15:25 +0000
committerDuncan Sands <baldrick@free.fr>2010-12-22 17:15:25 +0000
commit1cd05bb605e3c3eee9197d3f10b628c60d0cc07a (patch)
tree609a6fe57846ab8aae306f276b9db8157c866145 /test/Transforms/InstSimplify
parentb3898af89fb4cb8146076e1a8e0bd5ecea4f5944 (diff)
downloadllvm-1cd05bb605e3c3eee9197d3f10b628c60d0cc07a.tar.gz
llvm-1cd05bb605e3c3eee9197d3f10b628c60d0cc07a.tar.bz2
llvm-1cd05bb605e3c3eee9197d3f10b628c60d0cc07a.tar.xz
When determining whether the new instruction was already present in
the original instruction, half the cases were missed (making it not wrong but suboptimal). Also correct a typo (A <-> B) in the second chunk. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122414 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstSimplify')
-rw-r--r--test/Transforms/InstSimplify/2010-12-20-Distribute.ll11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/Transforms/InstSimplify/2010-12-20-Distribute.ll b/test/Transforms/InstSimplify/2010-12-20-Distribute.ll
index 4aac8dd588..60cef48446 100644
--- a/test/Transforms/InstSimplify/2010-12-20-Distribute.ll
+++ b/test/Transforms/InstSimplify/2010-12-20-Distribute.ll
@@ -20,6 +20,17 @@ define i32 @factorize2(i32 %x) {
; CHECK: ret i32 %x
}
+define i32 @factorize3(i32 %x, i32 %a, i32 %b) {
+; CHECK: @factorize3
+; (X | (A|B)) & (X | B) -> X | ((A|B) & B) -> X | B
+ %aORb = or i32 %a, %b
+ %l = or i32 %x, %aORb
+ %r = or i32 %x, %b
+ %z = and i32 %l, %r
+ ret i32 %z
+; CHECK: ret i32 %r
+}
+
define i32 @expand(i32 %x) {
; CHECK: @expand
; ((X & 1) | 2) & 1 -> ((X & 1) & 1) | (2 & 1) -> (X & 1) | 0 -> X & 1