Add a test for the foldSelectICmpAndOr fix committed in r180779.
[oota-llvm.git] / test / Transforms / InstCombine / div.ll
index 7ef640b4203349aa1b8a85f37e4c67002aa313ca..8a0897b972de39f92f801dc5a948d0e8d6f02833 100644 (file)
@@ -111,3 +111,24 @@ define i32 @test13(i32 %x) nounwind  {
 ; CHECK-NEXT: ret i32 1
 }
 
+define i32 @test14(i8 %x) nounwind {
+       %zext = zext i8 %x to i32
+       %div = udiv i32 %zext, 257      ; 0
+       ret i32 %div
+; CHECK: @test14
+; CHECK-NEXT: ret i32 0
+}
+
+; PR9814
+define i32 @test15(i32 %a, i32 %b) nounwind {
+  %shl = shl i32 1, %b
+  %div = lshr i32 %shl, 2
+  %div2 = udiv i32 %a, %div
+  ret i32 %div2
+; CHECK: @test15
+; CHECK-NEXT: add i32 %b, -2
+; CHECK-NEXT: lshr i32 %a, 
+; CHECK-NEXT: ret i32
+}
+
+