Add a test for the foldSelectICmpAndOr fix committed in r180779.
[oota-llvm.git] / test / Transforms / InstCombine / apint-sub.ll
index 12f366de7f46fa8963a8f5c0c89770f4c3199a5e..df8ec52b5abd85e4c0185c3a89e699084b314489 100644 (file)
@@ -2,8 +2,8 @@
 ; even with arbitrary precision integers.
 ;
 
-; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
-; RUN:   grep -v {sub i19 %Cok, %Bok} | not grep sub
+; RUN: opt < %s -instcombine -S | \
+; RUN:   grep -v "sub i19 %Cok, %Bok" | grep -v "sub i25 0, %Aok" | not grep sub
 ; END.
 
 define i23 @test1(i23 %A) {
@@ -107,8 +107,10 @@ define i51 @test16(i51 %A) {
        ret i51 %Y
 }
 
-define i25 @test17(i25 %A) {
-       %B = sub i25 0, %A              ; <i25> [#uses=1]
+; Can't fold subtract here because negation it might oveflow.
+; PR3142
+define i25 @test17(i25 %Aok) {
+       %B = sub i25 0, %Aok            ; <i25> [#uses=1]
        %C = sdiv i25 %B, 1234          ; <i25> [#uses=1]
        ret i25 %C
 }