diff options
author | Tanya Lattner <tonic@nondot.org> | 2008-03-01 09:15:35 +0000 |
---|---|---|
committer | Tanya Lattner <tonic@nondot.org> | 2008-03-01 09:15:35 +0000 |
commit | ec9a35a6f9143cfa325e0413cc297c48f627973a (patch) | |
tree | c1b0621415acc20f94152c51174d53fae3dbc8cc /test/Transforms/ConstProp | |
parent | ab3b77834c9232e4c13acb29afe1920b97c5a20b (diff) | |
download | external_llvm-ec9a35a6f9143cfa325e0413cc297c48f627973a.zip external_llvm-ec9a35a6f9143cfa325e0413cc297c48f627973a.tar.gz external_llvm-ec9a35a6f9143cfa325e0413cc297c48f627973a.tar.bz2 |
Remove llvm-upgrade and update test cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47793 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/ConstProp')
-rw-r--r-- | test/Transforms/ConstProp/2002-05-03-DivideByZeroException.ll | 15 | ||||
-rw-r--r-- | test/Transforms/ConstProp/2002-05-03-NotOperator.ll | 17 | ||||
-rw-r--r-- | test/Transforms/ConstProp/2002-09-03-SetCC-Bools.ll | 28 | ||||
-rw-r--r-- | test/Transforms/ConstProp/2003-05-12-DivideError.ll | 14 | ||||
-rw-r--r-- | test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll | 17 | ||||
-rw-r--r-- | test/Transforms/ConstProp/2006-11-30-vector-cast.ll | 11 | ||||
-rw-r--r-- | test/Transforms/ConstProp/2006-12-01-TruncBoolBug.ll | 9 | ||||
-rw-r--r-- | test/Transforms/ConstProp/2006-12-01-bool-casts.ll | 16 | ||||
-rw-r--r-- | test/Transforms/ConstProp/basictest.ll | 26 | ||||
-rw-r--r-- | test/Transforms/ConstProp/bitcast.ll | 5 | ||||
-rw-r--r-- | test/Transforms/ConstProp/bswap.ll | 29 | ||||
-rw-r--r-- | test/Transforms/ConstProp/calls.ll | 49 | ||||
-rw-r--r-- | test/Transforms/ConstProp/float-to-ptr-cast.ll | 13 | ||||
-rw-r--r-- | test/Transforms/ConstProp/logicaltest.ll | 35 | ||||
-rw-r--r-- | test/Transforms/ConstProp/nottest.ll | 20 | ||||
-rw-r--r-- | test/Transforms/ConstProp/phi.ll | 19 | ||||
-rw-r--r-- | test/Transforms/ConstProp/remtest.ll | 27 |
17 files changed, 194 insertions, 156 deletions
diff --git a/test/Transforms/ConstProp/2002-05-03-DivideByZeroException.ll b/test/Transforms/ConstProp/2002-05-03-DivideByZeroException.ll index 331501a..1a0845c 100644 --- a/test/Transforms/ConstProp/2002-05-03-DivideByZeroException.ll +++ b/test/Transforms/ConstProp/2002-05-03-DivideByZeroException.ll @@ -1,14 +1,15 @@ ; Make sure that the constant propogator doesn't divide by zero! ; -; RUN: llvm-upgrade < %s | llvm-as | opt -constprop +; RUN: llvm-as < %s | opt -constprop ; -int "test"() { - %R = div int 12, 0 - ret int %R +define i32 @test() { + %R = sdiv i32 12, 0 ; <i32> [#uses=1] + ret i32 %R } -int "test2"() { - %R = rem int 12, 0 - ret int %R +define i32 @test2() { + %R = srem i32 12, 0 ; <i32> [#uses=1] + ret i32 %R } + diff --git a/test/Transforms/ConstProp/2002-05-03-NotOperator.ll b/test/Transforms/ConstProp/2002-05-03-NotOperator.ll index 51f352c..7a281aa 100644 --- a/test/Transforms/ConstProp/2002-05-03-NotOperator.ll +++ b/test/Transforms/ConstProp/2002-05-03-NotOperator.ll @@ -4,15 +4,16 @@ ; Fix #2: The unary not instruction now no longer exists. Change to xor. -; RUN: llvm-upgrade < $test | llvm-as | opt -constprop | llvm-dis | \ -; RUN: not grep {int 0} +; RUN: llvm-as < $test | opt -constprop | llvm-dis | \ +; RUN: not grep {i32 0} -int "test1"() { - %R = xor int 123, -1 - ret int %R +define i32 @test1() { + %R = xor i32 123, -1 ; <i32> [#uses=1] + ret i32 %R } -int "test2"() { - %R = xor int -123, -1 - ret int %R +define i32 @test2() { + %R = xor i32 -123, -1 ; <i32> [#uses=1] + ret i32 %R } + diff --git a/test/Transforms/ConstProp/2002-09-03-SetCC-Bools.ll b/test/Transforms/ConstProp/2002-09-03-SetCC-Bools.ll index cf44346..781d796 100644 --- a/test/Transforms/ConstProp/2002-09-03-SetCC-Bools.ll +++ b/test/Transforms/ConstProp/2002-09-03-SetCC-Bools.ll @@ -1,20 +1,20 @@ ; SetCC on boolean values was not implemented! -; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -die | llvm-dis | \ +; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | \ ; RUN: not grep set -bool "test1"() { - %A = setle bool true, false - %B = setge bool true, false - %C = setlt bool false, true - %D = setgt bool true, false - %E = seteq bool false, false - %F = setne bool false, true - %G = and bool %A, %B - %H = and bool %C, %D - %I = and bool %E, %F - %J = and bool %G, %H - %K = and bool %I, %J - ret bool %K +define i1 @test1() { + %A = icmp ule i1 true, false ; <i1> [#uses=1] + %B = icmp uge i1 true, false ; <i1> [#uses=1] + %C = icmp ult i1 false, true ; <i1> [#uses=1] + %D = icmp ugt i1 true, false ; <i1> [#uses=1] + %E = icmp eq i1 false, false ; <i1> [#uses=1] + %F = icmp ne i1 false, true ; <i1> [#uses=1] + %G = and i1 %A, %B ; <i1> [#uses=1] + %H = and i1 %C, %D ; <i1> [#uses=1] + %I = and i1 %E, %F ; <i1> [#uses=1] + %J = and i1 %G, %H ; <i1> [#uses=1] + %K = and i1 %I, %J ; <i1> [#uses=1] + ret i1 %K } diff --git a/test/Transforms/ConstProp/2003-05-12-DivideError.ll b/test/Transforms/ConstProp/2003-05-12-DivideError.ll index 289384b..a3f239f 100644 --- a/test/Transforms/ConstProp/2003-05-12-DivideError.ll +++ b/test/Transforms/ConstProp/2003-05-12-DivideError.ll @@ -1,15 +1,15 @@ ; Make sure that the constant propagator doesn't cause a sigfpe ; -; RUN: llvm-upgrade < %s | llvm-as | opt -constprop +; RUN: llvm-as < %s | opt -constprop ; -int "test"() { - %R = div int -2147483648, -1 - ret int %R +define i32 @test() { + %R = sdiv i32 -2147483648, -1 ; <i32> [#uses=1] + ret i32 %R } -int "test2"() { - %R = rem int -2147483648, -1 - ret int %R +define i32 @test2() { + %R = srem i32 -2147483648, -1 ; <i32> [#uses=1] + ret i32 %R } diff --git a/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll b/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll index ee1f251..9ffbcd1 100644 --- a/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll +++ b/test/Transforms/ConstProp/2005-01-28-SetCCGEP.ll @@ -1,13 +1,10 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -constprop | llvm-dis | \ -; RUN: not grep {ret bool false} +; RUN: llvm-as < %s | opt -constprop | llvm-dis | \ +; RUN: not grep {ret i1 false} -%b = external global [2 x { }] +@b = external global [2 x { }] ; <[2 x { }]*> [#uses=2] -implementation - -bool %f() { - ; tmp.2 -> true, not false. - %tmp.2 = seteq { }* getelementptr ([2 x { }]* %b, int 0, int 0), - getelementptr ([2 x { }]* %b, int 0, int 1) - ret bool %tmp.2 +define i1 @f() { + %tmp.2 = icmp eq { }* getelementptr ([2 x { }]* @b, i32 0, i32 0), getelementptr ([2 x { }]* @b, i32 0, i32 1) ; <i1> [#uses=1] + ret i1 %tmp.2 } + diff --git a/test/Transforms/ConstProp/2006-11-30-vector-cast.ll b/test/Transforms/ConstProp/2006-11-30-vector-cast.ll index 80f4252..812cbcf 100644 --- a/test/Transforms/ConstProp/2006-11-30-vector-cast.ll +++ b/test/Transforms/ConstProp/2006-11-30-vector-cast.ll @@ -1,9 +1,10 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -constprop | llvm-dis | \ +; RUN: llvm-as < %s | opt -constprop | llvm-dis | \ ; RUN: grep {i32 -1} -; RUN: llvm-upgrade < %s | llvm-as | opt -constprop | llvm-dis | \ +; RUN: llvm-as < %s | opt -constprop | llvm-dis | \ ; RUN: not grep zeroinitializer -< 4 x uint> %test() { - %tmp40 = bitcast <2 x long> bitcast (<4 x int> < int 0, int 0, int -1, int 0 > to <2 x long>) to <4 x uint> - ret <4 x uint> %tmp40 +define <4 x i32> @test() { + %tmp40 = bitcast <2 x i64> bitcast (<4 x i32> < i32 0, i32 0, i32 -1, i32 0 > to <2 x i64>) to <4 x i32>; <<4 x i32>> [#uses=1] + ret <4 x i32> %tmp40 } + diff --git a/test/Transforms/ConstProp/2006-12-01-TruncBoolBug.ll b/test/Transforms/ConstProp/2006-12-01-TruncBoolBug.ll index 779f6be..889ef56 100644 --- a/test/Transforms/ConstProp/2006-12-01-TruncBoolBug.ll +++ b/test/Transforms/ConstProp/2006-12-01-TruncBoolBug.ll @@ -1,6 +1,7 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \ ; RUN: grep {ret i1 false} -bool %test() { - %X = trunc uint 320 to bool - ret bool %X +define i1 @test() { + %X = trunc i32 320 to i1 ; <i1> [#uses=1] + ret i1 %X } + diff --git a/test/Transforms/ConstProp/2006-12-01-bool-casts.ll b/test/Transforms/ConstProp/2006-12-01-bool-casts.ll index 2474132..dd1e46d 100644 --- a/test/Transforms/ConstProp/2006-12-01-bool-casts.ll +++ b/test/Transforms/ConstProp/2006-12-01-bool-casts.ll @@ -1,15 +1,15 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -constprop | llvm-dis | \ +; RUN: llvm-as < %s | opt -constprop | llvm-dis | \ ; RUN: grep {ret i32 -1} -; RUN: llvm-upgrade < %s | llvm-as | opt -constprop | llvm-dis | \ +; RUN: llvm-as < %s | opt -constprop | llvm-dis | \ ; RUN: grep {ret i32 1} -int %test1() { - %A = sext bool true to int - ret int %A +define i32 @test1() { + %A = sext i1 true to i32 ; <i32> [#uses=1] + ret i32 %A } -uint %test2() { - %A = zext bool true to uint - ret uint %A +define i32 @test2() { + %A = zext i1 true to i32 ; <i32> [#uses=1] + ret i32 %A } diff --git a/test/Transforms/ConstProp/basictest.ll b/test/Transforms/ConstProp/basictest.ll index 178467d..56892d9 100644 --- a/test/Transforms/ConstProp/basictest.ll +++ b/test/Transforms/ConstProp/basictest.ll @@ -1,16 +1,20 @@ ; This is a basic sanity check for constant propogation. The add instruction ; should be eliminated. -; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -die | llvm-dis | not grep add +; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | not grep add -int %test(bool %B) { - br bool %B, label %BB1, label %BB2 -BB1: - %Val = add int 0, 0 - br label %BB3 -BB2: - br label %BB3 -BB3: - %Ret = phi int [%Val, %BB1], [1, %BB2] - ret int %Ret +define i32 @test(i1 %B) { + br i1 %B, label %BB1, label %BB2 + +BB1: ; preds = %0 + %Val = add i32 0, 0 ; <i32> [#uses=1] + br label %BB3 + +BB2: ; preds = %0 + br label %BB3 + +BB3: ; preds = %BB2, %BB1 + %Ret = phi i32 [ %Val, %BB1 ], [ 1, %BB2 ] ; <i32> [#uses=1] + ret i32 %Ret } + diff --git a/test/Transforms/ConstProp/bitcast.ll b/test/Transforms/ConstProp/bitcast.ll index 1fc2570..bf943c9 100644 --- a/test/Transforms/ConstProp/bitcast.ll +++ b/test/Transforms/ConstProp/bitcast.ll @@ -1,3 +1,2 @@ -; RUN: llvm-upgrade < %s | llvm-as | llvm-dis | grep 0x36A0000000000000 - -%A = global float bitcast (int 1 to float) +; RUN: llvm-as < %s | llvm-dis | grep 0x36A0000000000000 +@A = global float 0x36A0000000000000 ; <float*> [#uses=0] diff --git a/test/Transforms/ConstProp/bswap.ll b/test/Transforms/ConstProp/bswap.ll index d31fa9d..4975827 100644 --- a/test/Transforms/ConstProp/bswap.ll +++ b/test/Transforms/ConstProp/bswap.ll @@ -1,22 +1,25 @@ ; bswap should be constant folded when it is passed a constant argument -; RUN: llvm-upgrade < %s | llvm-as | opt -constprop | llvm-dis | not grep call +; RUN: llvm-as < %s | opt -constprop | llvm-dis | not grep call -declare ushort %llvm.bswap.i16(ushort) -declare uint %llvm.bswap.i32(uint) -declare ulong %llvm.bswap.i64(ulong) +declare i16 @llvm.bswap.i16(i16) -ushort %W() { - %Z = call ushort %llvm.bswap.i16(ushort 1) - ret ushort %Z +declare i32 @llvm.bswap.i32(i32) + +declare i64 @llvm.bswap.i64(i64) + +define i16 @W() { + %Z = call i16 @llvm.bswap.i16( i16 1 ) ; <i16> [#uses=1] + ret i16 %Z } -uint %X() { - %Z = call uint %llvm.bswap.i32(uint 1) - ret uint %Z +define i32 @X() { + %Z = call i32 @llvm.bswap.i32( i32 1 ) ; <i32> [#uses=1] + ret i32 %Z } -ulong %Y() { - %Z = call ulong %llvm.bswap.i64(ulong 1) - ret ulong %Z +define i64 @Y() { + %Z = call i64 @llvm.bswap.i64( i64 1 ) ; <i64> [#uses=1] + ret i64 %Z } + diff --git a/test/Transforms/ConstProp/calls.ll b/test/Transforms/ConstProp/calls.ll index c4a8206..126db4c 100644 --- a/test/Transforms/ConstProp/calls.ll +++ b/test/Transforms/ConstProp/calls.ll @@ -1,25 +1,30 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -constprop | llvm-dis | not grep call - -declare double %cos(double) -declare double %sin(double) -declare double %tan(double) -declare double %sqrt(double) -declare bool %llvm.isunordered.f64(double, double) - -double %T() { - %A = call double %cos(double 0.0) - %B = call double %sin(double 0.0) - %a = add double %A, %B - %C = call double %tan(double 0.0) - %b = add double %a, %C - %D = call double %sqrt(double 4.0) - %c = add double %b, %D - ret double %c +; RUN: llvm-as < %s | opt -constprop | llvm-dis | not grep call + +declare double @cos(double) + +declare double @sin(double) + +declare double @tan(double) + +declare double @sqrt(double) + +declare i1 @llvm.isunordered.f64(double, double) + +define double @T() { + %A = call double @cos( double 0.000000e+00 ) ; <double> [#uses=1] + %B = call double @sin( double 0.000000e+00 ) ; <double> [#uses=1] + %a = add double %A, %B ; <double> [#uses=1] + %C = call double @tan( double 0.000000e+00 ) ; <double> [#uses=1] + %b = add double %a, %C ; <double> [#uses=1] + %D = call double @sqrt( double 4.000000e+00 ) ; <double> [#uses=1] + %c = add double %b, %D ; <double> [#uses=1] + ret double %c } -bool %TNAN() { - %A = call bool %llvm.isunordered.f64(double 0x7FF8000000000000, double 1.0) ;; it's a nan! - %B = call bool %llvm.isunordered.f64(double 123.0, double 1.0) - %C = or bool %A, %B - ret bool %C +define i1 @TNAN() { + %A = fcmp uno double 0x7FF8000000000000, 1.000000e+00 ; <i1> [#uses=1] + %B = fcmp uno double 1.230000e+02, 1.000000e+00 ; <i1> [#uses=1] + %C = or i1 %A, %B ; <i1> [#uses=1] + ret i1 %C } + diff --git a/test/Transforms/ConstProp/float-to-ptr-cast.ll b/test/Transforms/ConstProp/float-to-ptr-cast.ll index 239b748..cbf84f5 100644 --- a/test/Transforms/ConstProp/float-to-ptr-cast.ll +++ b/test/Transforms/ConstProp/float-to-ptr-cast.ll @@ -1,11 +1,12 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -constprop | llvm-dis | \ +; RUN: llvm-as < %s | opt -constprop | llvm-dis | \ ; RUN: grep -F {ret i32* null} | count 2 -int* %test1() { - %X = cast float 0.0 to int* - ret int* %X +define i32* @test1() { + %X = inttoptr i64 0 to i32* ; <i32*> [#uses=1] + ret i32* %X } -int* %test2() { - ret int* cast (float 0.0 to int*) +define i32* @test2() { + ret i32* null } + diff --git a/test/Transforms/ConstProp/logicaltest.ll b/test/Transforms/ConstProp/logicaltest.ll index ce31114..81bdb95 100644 --- a/test/Transforms/ConstProp/logicaltest.ll +++ b/test/Transforms/ConstProp/logicaltest.ll @@ -1,14 +1,35 @@ ; Ensure constant propogation of logical instructions is working correctly. -; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -die | llvm-dis | \ +; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | \ ; RUN: not egrep {and|or|xor} +define i32 @test1() { + %R = and i32 4, 1234 ; <i32> [#uses=1] + ret i32 %R +} -int "test1"() { %R = and int 4,1234 ret int %R } -bool "test1"() { %R = and bool true, false ret bool %R } +define i1 @test1.upgrd.1() { + %R = and i1 true, false ; <i1> [#uses=1] + ret i1 %R +} -int "test2"() { %R = or int 4,1234 ret int %R } -bool "test2"() { %R = or bool true, false ret bool %R } +define i32 @test2() { + %R = or i32 4, 1234 ; <i32> [#uses=1] + ret i32 %R +} + +define i1 @test2.upgrd.2() { + %R = or i1 true, false ; <i1> [#uses=1] + ret i1 %R +} + +define i32 @test3() { + %R = xor i32 4, 1234 ; <i32> [#uses=1] + ret i32 %R +} + +define i1 @test3.upgrd.3() { + %R = xor i1 true, false ; <i1> [#uses=1] + ret i1 %R +} -int "test3"() { %R = xor int 4,1234 ret int %R } -bool "test3"() { %R = xor bool true, false ret bool %R } diff --git a/test/Transforms/ConstProp/nottest.ll b/test/Transforms/ConstProp/nottest.ll index 022a513..41ea1b3 100644 --- a/test/Transforms/ConstProp/nottest.ll +++ b/test/Transforms/ConstProp/nottest.ll @@ -1,19 +1,19 @@ ; Ensure constant propogation of 'not' instructions is working correctly. -; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -die | llvm-dis | not grep xor +; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | not grep xor -int "test1"() { - %R = xor int 4, -1 - ret int %R +define i32 @test1() { + %R = xor i32 4, -1 ; <i32> [#uses=1] + ret i32 %R } -int "test2"() { - %R = xor int -23, -1 - ret int %R +define i32 @test2() { + %R = xor i32 -23, -1 ; <i32> [#uses=1] + ret i32 %R } -bool "test3"() { - %R = xor bool true, true - ret bool %R +define i1 @test3() { + %R = xor i1 true, true ; <i1> [#uses=1] + ret i1 %R } diff --git a/test/Transforms/ConstProp/phi.ll b/test/Transforms/ConstProp/phi.ll index d7624dc..858c0be 100644 --- a/test/Transforms/ConstProp/phi.ll +++ b/test/Transforms/ConstProp/phi.ll @@ -1,14 +1,17 @@ ; This is a basic sanity check for constant propogation. The add instruction ; should be eliminated. -; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -die | llvm-dis | not grep phi +; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | not grep phi -int %test(bool %B) { +define i32 @test(i1 %B) { BB0: - br bool %B, label %BB1, label %BB3 -BB1: - br label %BB3 -BB3: - %Ret = phi int [1, %BB0], [1, %BB1] - ret int %Ret + br i1 %B, label %BB1, label %BB3 + +BB1: ; preds = %BB0 + br label %BB3 + +BB3: ; preds = %BB1, %BB0 + %Ret = phi i32 [ 1, %BB0 ], [ 1, %BB1 ] ; <i32> [#uses=1] + ret i32 %Ret } + diff --git a/test/Transforms/ConstProp/remtest.ll b/test/Transforms/ConstProp/remtest.ll index fd56012..11861a4 100644 --- a/test/Transforms/ConstProp/remtest.ll +++ b/test/Transforms/ConstProp/remtest.ll @@ -1,23 +1,24 @@ ; Ensure constant propagation of remainder instructions is working correctly. -; RUN: llvm-upgrade < %s | llvm-as | opt -constprop -die | llvm-dis | not grep rem +; RUN: llvm-as < %s | opt -constprop -die | llvm-dis | not grep rem -int %test1() { - %R = rem int 4, 3 - ret int %R +define i32 @test1() { + %R = srem i32 4, 3 ; <i32> [#uses=1] + ret i32 %R } -int %test2() { - %R = rem int 123, -23 - ret int %R +define i32 @test2() { + %R = srem i32 123, -23 ; <i32> [#uses=1] + ret i32 %R } -float %test3() { - %R = rem float 0x4028E66660000000, 0x405ECDA1C0000000 - ret float %R +define float @test3() { + %R = frem float 0x4028E66660000000, 0x405ECDA1C0000000 ; <float> [#uses=1] + ret float %R } -double %test4() { - %R = rem double 0x4073833BEE07AFF8, 0x4028AAABB2A0D19C - ret double %R +define double @test4() { + %R = frem double 0x4073833BEE07AFF8, 0x4028AAABB2A0D19C ; <double> [#uses=1] + ret double %R } + |