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.
llvm-svn: 122414
diff --git a/llvm/test/Transforms/InstSimplify/2010-12-20-Distribute.ll b/llvm/test/Transforms/InstSimplify/2010-12-20-Distribute.ll
index 4aac8dd..60cef48 100644
--- a/llvm/test/Transforms/InstSimplify/2010-12-20-Distribute.ll
+++ b/llvm/test/Transforms/InstSimplify/2010-12-20-Distribute.ll
@@ -20,6 +20,17 @@
; 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