Make instsimplify's analysis of icmp eq/ne use computeKnownBits to determine whether...
[oota-llvm.git] / test / Transforms / InstSimplify / compare.ll
index 105e244ed8cf8435bc6296fa491459df9675bc32..89fd6362d78d2c2d243cbf7399473d2a65352664 100644 (file)
@@ -883,3 +883,22 @@ define i1 @returns_nonnull() {
 ; CHECK: ret i1 false
 }
 
+; If a bit is known to be zero for A and known to be one for B,
+; then A and B cannot be equal.
+define i1 @icmp_eq_const(i32 %a) nounwind {
+  %b = mul nsw i32 %a, -2
+  %c = icmp eq i32 %b, 1
+  ret i1 %c
+
+; CHECK-LABEL: @icmp_eq_const
+; CHECK-NEXT: ret i1 false 
+}
+
+define i1 @icmp_ne_const(i32 %a) nounwind {
+  %b = mul nsw i32 %a, -2
+  %c = icmp ne i32 %b, 1
+  ret i1 %c
+
+; CHECK-LABEL: @icmp_ne_const
+; CHECK-NEXT: ret i1 true
+}