Remove llvm-upgrade and update tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48137 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Tanya Lattner committed 2008-03-10 07:21:50 +00:00
1 parent f79e60649a
commit ceca194c43
115 files changed
+2564 -3125

No files matched your search

+27 -36
View File
@@ -1,47 +1,38 @@
; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
%.LC0 = internal global [10 x sbyte] c"argc: %d\0A\00"
@.LC0 = internal global [10 x i8] c"argc: %d\0A\00" ; <[10 x i8]*> [#uses=1]
implementation ; Functions:
declare i32 @puts(i8*)
declare int %puts(sbyte*)
void %getoptions(int* %argc) {
bb0: ; No predecessors!
define void @getoptions(i32* %argc) {
bb0:
ret void
}
declare int %printf(sbyte*, ...)
int %main(int %argc, sbyte** %argv) {
bb0: ; No predecessors!
call int (sbyte*, ...)* %printf( sbyte* getelementptr ([10 x sbyte]* %.LC0, long 0, long 0), int %argc)
%cast224 = cast sbyte** %argv to sbyte* ; <sbyte*> [#uses=1]
%local = alloca sbyte* ; <sbyte**> [#uses=3]
store sbyte* %cast224, sbyte** %local
%cond226 = setle int %argc, 0 ; <bool> [#uses=1]
br bool %cond226, label %bb3, label %bb2
declare i32 @printf(i8*, ...)
define i32 @main(i32 %argc, i8** %argv) {
bb0:
call i32 (i8*, ...)* @printf( i8* getelementptr ([10 x i8]* @.LC0, i64 0, i64 0), i32 %argc ) ; <i32>:0 [#uses=0]
%cast224 = bitcast i8** %argv to i8* ; <i8*> [#uses=1]
%local = alloca i8* ; <i8**> [#uses=3]
store i8* %cast224, i8** %local
%cond226 = icmp sle i32 %argc, 0 ; <i1> [#uses=1]
br i1 %cond226, label %bb3, label %bb2
bb2: ; preds = %bb2, %bb0
%cann-indvar = phi int [ 0, %bb0 ], [ %add1-indvar, %bb2 ] ; <int> [#uses=2]
%add1-indvar = add int %cann-indvar, 1 ; <int> [#uses=2]
%cann-indvar-idxcast = cast int %cann-indvar to long ; <long> [#uses=1]
;%reg115 = load sbyte** %local ; <sbyte*> [#uses=1]
;%cann-indvar-idxcast-scale = mul long %cann-indvar-idxcast, 8 ; <long> [#uses=1]
;%reg232 = getelementptr sbyte* %reg115, long %cann-indvar-idxcast-scale ; <sbyte*> [#uses=1]
;%cast235 = cast sbyte* %reg232 to sbyte** ; <sbyte**> [#uses=1]
%CT = cast sbyte** %local to sbyte***
%reg115 = load sbyte*** %CT
%cast235 = getelementptr sbyte** %reg115, long %cann-indvar-idxcast
%reg117 = load sbyte** %cast235 ; <sbyte*> [#uses=1]
%reg236 = call int %puts( sbyte* %reg117 ) ; <int> [#uses=0]
%cond239 = setlt int %add1-indvar, %argc ; <bool> [#uses=1]
br bool %cond239, label %bb2, label %bb3
%cann-indvar = phi i32 [ 0, %bb0 ], [ %add1-indvar, %bb2 ] ; <i32> [#uses=2]
%add1-indvar = add i32 %cann-indvar, 1 ; <i32> [#uses=2]
%cann-indvar-idxcast = sext i32 %cann-indvar to i64 ; <i64> [#uses=1]
%CT = bitcast i8** %local to i8*** ; <i8***> [#uses=1]
%reg115 = load i8*** %CT ; <i8**> [#uses=1]
%cast235 = getelementptr i8** %reg115, i64 %cann-indvar-idxcast ; <i8**> [#uses=1]
%reg117 = load i8** %cast235 ; <i8*> [#uses=1]
%reg236 = call i32 @puts( i8* %reg117 ) ; <i32> [#uses=0]
%cond239 = icmp slt i32 %add1-indvar, %argc ; <i1> [#uses=1]
br i1 %cond239, label %bb2, label %bb3
bb3: ; preds = %bb2, %bb0
%cast243 = cast sbyte** %local to int* ; <int*> [#uses=1]
call void %getoptions( int* %cast243 )
ret int 0
%cast243 = bitcast i8** %local to i32* ; <i32*> [#uses=1]
call void @getoptions( i32* %cast243 )
ret i32 0
}
+9 -11
View File
@@ -1,16 +1,14 @@
; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
implementation ; Functions:
int %foo(int %X, int %Y, double %A) {
%cond212 = setne double %A, 1.000000e+00 ; <bool> [#uses=1]
%cast110 = cast bool %cond212 to int ; <int> [#uses=1]
ret int %cast110
define i32 @foo(i32 %X, i32 %Y, double %A) {
%cond212 = fcmp une double %A, 1.000000e+00 ; <i1> [#uses=1]
%cast110 = zext i1 %cond212 to i32 ; <i32> [#uses=1]
ret i32 %cast110
}
int %main() {
%reg212 = call int %foo( int 0, int 1, double 1.000000e+00 ) ; <int> [#uses=1]
ret int %reg212
define i32 @main() {
%reg212 = call i32 @foo( i32 0, i32 1, double 1.000000e+00 ) ; <i32> [#uses=1]
ret i32 %reg212
}
+14 -18
View File
@@ -1,25 +1,21 @@
; RUN: llvm-upgrade < %s | llvm-as -o %t.bc -f
; RUN: llvm-as < %s -o %t.bc -f
; RUN: lli %t.bc > /dev/null
implementation
int %main() {
call int %mylog(int 4)
ret int 0
define i32 @main() {
call i32 @mylog( i32 4 ) ; <i32>:1 [#uses=0]
ret i32 0
}
internal int %mylog(int %num) {
bb0: ; No predecessors!
define internal i32 @mylog(i32 %num) {
bb0:
br label %bb2
bb2:
%reg112 = phi int [ 10, %bb2 ], [ 1, %bb0 ]
%cann-indvar = phi int [ %cann-indvar, %bb2 ], [0, %bb0]
%reg114 = add int %reg112, 1
%cond222 = setlt int %reg114, %num
br bool %cond222, label %bb2, label %bb3
bb3: ; preds = %bb2, %bb0
ret int %reg114
bb2: ; preds = %bb2, %bb0
%reg112 = phi i32 [ 10, %bb2 ], [ 1, %bb0 ] ; <i32> [#uses=1]
%cann-indvar = phi i32 [ %cann-indvar, %bb2 ], [ 0, %bb0 ] ; <i32> [#uses=1]
%reg114 = add i32 %reg112, 1 ; <i32> [#uses=2]
%cond222 = icmp slt i32 %reg114, %num ; <i1> [#uses=1]
br i1 %cond222, label %bb2, label %bb3
bb3: ; preds = %bb2
ret i32 %reg114
}
+9 -7
View File
@@ -1,11 +1,13 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
int %main() {
define i32 @main() {
; <label>:0
br label %Loop
Loop:
%X = phi int [0, %0], [1, %Loop]
br bool true, label %Out, label %Loop
Out:
ret int %X
Loop: ; preds = %Loop, %0
%X = phi i32 [ 0, %0 ], [ 1, %Loop ] ; <i32> [#uses=1]
br i1 true, label %Out, label %Loop
Out: ; preds = %Loop
ret i32 %X
}
+7 -6
View File
@@ -1,11 +1,12 @@
; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
; We were accidentally inverting the signedness of right shifts. Whoops.
int %main() {
%X = shr int -1, ubyte 16
%Y = shr int %X, ubyte 16
%Z = add int %Y, 1
ret int %Z
define i32 @main() {
%X = ashr i32 -1, 16 ; <i32> [#uses=1]
%Y = ashr i32 %X, 16 ; <i32> [#uses=1]
%Z = add i32 %Y, 1 ; <i32> [#uses=1]
ret i32 %Z
}
+8 -8
View File
@@ -1,11 +1,11 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
int %main() {
%X = add double 0.0, 1.0
%Y = sub double 0.0, 1.0
%Z = seteq double %X, %Y
add double %Y, 0.0
ret int 0
define i32 @main() {
%X = add double 0.000000e+00, 1.000000e+00 ; <double> [#uses=1]
%Y = sub double 0.000000e+00, 1.000000e+00 ; <double> [#uses=2]
%Z = fcmp oeq double %X, %Y ; <i1> [#uses=0]
add double %Y, 0.000000e+00 ; <double>:1 [#uses=0]
ret i32 0
}
@@ -1,19 +1,18 @@
; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
int %bar(sbyte* %X) {
%P = alloca double ; pointer should be 4 byte aligned!
%R = cast double* %P to int
%A = and int %R, 3
ret int %A
define i32 @bar(i8* %X) {
; pointer should be 4 byte aligned!
%P = alloca double ; <double*> [#uses=1]
%R = ptrtoint double* %P to i32 ; <i32> [#uses=1]
%A = and i32 %R, 3 ; <i32> [#uses=1]
ret i32 %A
}
int %main() {
%SP = alloca sbyte
%X = add uint 0, 0
alloca sbyte, uint %X
call int %bar(sbyte* %SP)
ret int %0
define i32 @main() {
%SP = alloca i8 ; <i8*> [#uses=1]
%X = add i32 0, 0 ; <i32> [#uses=1]
alloca i8, i32 %X ; <i8*>:1 [#uses=0]
call i32 @bar( i8* %SP ) ; <i32>:2 [#uses=1]
ret i32 %2
}
@@ -1,20 +1,19 @@
; This testcase shoudl return with an exit code of 1.
;
; RUN: llvm-upgrade < %s | llvm-as | not lli
; RUN: llvm-as < %s | not lli
%test = global long 0
implementation
@test = global i64 0 ; <i64*> [#uses=1]
internal long %test() {
%tmp.0 = load long* %test ; <long> [#uses=1]
%tmp.1 = add long %tmp.0, 1 ; <long> [#uses=1]
ret long %tmp.1
define internal i64 @test.upgrd.1() {
%tmp.0 = load i64* @test ; <i64> [#uses=1]
%tmp.1 = add i64 %tmp.0, 1 ; <i64> [#uses=1]
ret i64 %tmp.1
}
int %main() {
%L = call long %test()
%I = cast long %L to int
ret int %I
define i32 @main() {
%L = call i64 @test.upgrd.1( ) ; <i64> [#uses=1]
%I = trunc i64 %L to i32 ; <i32> [#uses=1]
ret i32 %I
}
@@ -1,13 +1,11 @@
; RUN: llvm-upgrade < %s | llvm-as | lli - test
; RUN: llvm-as < %s | lli - test
implementation
declare i32 @puts(i8*)
declare int %puts(sbyte*)
int %main(int %argc.1, sbyte** %argv.1) {
%tmp.5 = getelementptr sbyte** %argv.1, long 1 ; <sbyte**> [#uses=1]
%tmp.6 = load sbyte** %tmp.5 ; <sbyte*> [#uses=1]
%tmp.0 = call int %puts( sbyte* %tmp.6 ) ; <int> [#uses=0]
ret int 0
define i32 @main(i32 %argc.1, i8** %argv.1) {
%tmp.5 = getelementptr i8** %argv.1, i64 1 ; <i8**> [#uses=1]
%tmp.6 = load i8** %tmp.5 ; <i8*> [#uses=1]
%tmp.0 = call i32 @puts( i8* %tmp.6 ) ; <i32> [#uses=0]
ret i32 0
}
@@ -1,18 +1,16 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
target endian = little
target pointersize = 32
target datalayout = "e-p:32:32"
implementation
int %main() {
define i32 @main() {
entry:
br label %endif
then:
then: ; No predecessors!
br label %endif
endif:
%x = phi uint [ 4, %entry ], [ 27, %then ]
%result = phi int [ 32, %then ], [ 0, %entry ]
ret int 0
endif: ; preds = %then, %entry
%x = phi i32 [ 4, %entry ], [ 27, %then ] ; <i32> [#uses=0]
%result = phi i32 [ 32, %then ], [ 0, %entry ] ; <i32> [#uses=0]
ret i32 0
}
+12 -14
View File
@@ -1,22 +1,20 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
; Testcase distilled from 256.bzip2.
target endian = little
target pointersize = 32
target datalayout = "e-p:32:32"
int %main() {
define i32 @main() {
entry:
br label %loopentry.0
loopentry.0:
%h.0 = phi int [ %tmp.2, %loopentry.0 ], [ -1, %entry ]
%tmp.2 = add int %h.0, 1
%tmp.4 = setne int %tmp.2, 0
br bool %tmp.4, label %loopentry.0, label %loopentry.1
loopentry.1:
%h.1 = phi int [ %tmp.2, %loopentry.0 ]
ret int %h.1
loopentry.0: ; preds = %loopentry.0, %entry
%h.0 = phi i32 [ %tmp.2, %loopentry.0 ], [ -1, %entry ] ; <i32> [#uses=1]
%tmp.2 = add i32 %h.0, 1 ; <i32> [#uses=3]
%tmp.4 = icmp ne i32 %tmp.2, 0 ; <i1> [#uses=1]
br i1 %tmp.4, label %loopentry.0, label %loopentry.1
loopentry.1: ; preds = %loopentry.0
%h.1 = phi i32 [ %tmp.2, %loopentry.0 ] ; <i32> [#uses=1]
ret i32 %h.1
}
+10 -11
View File
@@ -1,19 +1,18 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
; Testcase distilled from 256.bzip2.
target endian = little
target pointersize = 32
target datalayout = "e-p:32:32"
int %main() {
define i32 @main() {
entry:
%X = add int 1, -1
%X = add i32 1, -1 ; <i32> [#uses=3]
br label %Next
Next:
%A = phi int [ %X, %entry ]
%B = phi int [ %X, %entry ]
%C = phi int [ %X, %entry ]
ret int %C
Next: ; preds = %entry
%A = phi i32 [ %X, %entry ] ; <i32> [#uses=0]
%B = phi i32 [ %X, %entry ] ; <i32> [#uses=0]
%C = phi i32 [ %X, %entry ] ; <i32> [#uses=1]
ret i32 %C
}
@@ -1,12 +1,12 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
; This testcase failed to work because two variable sized allocas confused the
; local register allocator.
int %main(uint %X) {
%A = alloca uint, uint %X
%B = alloca float, uint %X
ret int 0
define i32 @main(i32 %X) {
%A = alloca i32, i32 %X ; <i32*> [#uses=0]
%B = alloca float, i32 %X ; <float*> [#uses=0]
ret i32 0
}
@@ -1,4 +1,4 @@
; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
;
@@ -9,15 +9,14 @@
; environment to the main() function.
;
implementation
declare uint %strlen(sbyte*)
declare i32 @strlen(i8*)
int %main(int %argc.1, sbyte** %argv.1, sbyte** %envp.1) {
%tmp.2 = load sbyte** %envp.1
%tmp.3 = call uint %strlen( sbyte* %tmp.2 )
%T = seteq uint %tmp.3, 0
%R = cast bool %T to int
ret int %R
define i32 @main(i32 %argc.1, i8** %argv.1, i8** %envp.1) {
%tmp.2 = load i8** %envp.1 ; <i8*> [#uses=1]
%tmp.3 = call i32 @strlen( i8* %tmp.2 ) ; <i32> [#uses=1]
%T = icmp eq i32 %tmp.3, 0 ; <i1> [#uses=1]
%R = zext i1 %T to i32 ; <i32> [#uses=1]
ret i32 %R
}
@@ -1,33 +1,35 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
; This testcase exposes a bug in the local register allocator where it runs out
; of registers (due to too many overlapping live ranges), but then attempts to
; use the ESP register (which is not allocatable) to hold a value.
int %main(uint %A) {
%Ap2 = alloca uint, uint %A ; ESP gets used again...
%B = add uint %A, 1 ; Produce lots of overlapping live ranges
%C = add uint %A, 2
%D = add uint %A, 3
%E = add uint %A, 4
%F = add uint %A, 5
%G = add uint %A, 6
%H = add uint %A, 7
%I = add uint %A, 8
%J = add uint %A, 9
%K = add uint %A, 10
store uint %A, uint *%Ap2 ; Uses of all of the values
store uint %B, uint *%Ap2
store uint %C, uint *%Ap2
store uint %D, uint *%Ap2
store uint %E, uint *%Ap2
store uint %F, uint *%Ap2
store uint %G, uint *%Ap2
store uint %H, uint *%Ap2
store uint %I, uint *%Ap2
store uint %J, uint *%Ap2
store uint %K, uint *%Ap2
ret int 0
define i32 @main(i32 %A) {
; ESP gets used again...
%Ap2 = alloca i32, i32 %A ; <i32*> [#uses=11]
; Produce lots of overlapping live ranges
%B = add i32 %A, 1 ; <i32> [#uses=1]
%C = add i32 %A, 2 ; <i32> [#uses=1]
%D = add i32 %A, 3 ; <i32> [#uses=1]
%E = add i32 %A, 4 ; <i32> [#uses=1]
%F = add i32 %A, 5 ; <i32> [#uses=1]
%G = add i32 %A, 6 ; <i32> [#uses=1]
%H = add i32 %A, 7 ; <i32> [#uses=1]
%I = add i32 %A, 8 ; <i32> [#uses=1]
%J = add i32 %A, 9 ; <i32> [#uses=1]
%K = add i32 %A, 10 ; <i32> [#uses=1]
; Uses of all of the values
store i32 %A, i32* %Ap2
store i32 %B, i32* %Ap2
store i32 %C, i32* %Ap2
store i32 %D, i32* %Ap2
store i32 %E, i32* %Ap2
store i32 %F, i32* %Ap2
store i32 %G, i32* %Ap2
store i32 %H, i32* %Ap2
store i32 %I, i32* %Ap2
store i32 %J, i32* %Ap2
store i32 %K, i32* %Ap2
ret i32 0
}
@@ -1,30 +1,24 @@
; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
%A = global int 0
@A = global i32 0 ; <i32*> [#uses=1]
int %main() {
%Ret = call int %test(bool true, int 0)
ret int %Ret
define i32 @main() {
%Ret = call i32 @test( i1 true, i32 0 ) ; <i32> [#uses=1]
ret i32 %Ret
}
int %test(bool %c, int %A) {
br bool %c, label %Taken1, label %NotTaken
Cont:
%V = phi int [0, %NotTaken],
[ sub (int cast (int* %A to int), int 1234), %Taken1]
ret int 0
NotTaken:
br label %Cont
Taken1:
%B = seteq int %A, 0
; Code got inserted here, breaking the condition code.
br bool %B, label %Cont, label %ExitError
ExitError:
ret int 12
define i32 @test(i1 %c, i32 %A) {
br i1 %c, label %Taken1, label %NotTaken
Cont: ; preds = %Taken1, %NotTaken
%V = phi i32 [ 0, %NotTaken ], [ sub (i32 ptrtoint (i32* @A to i32), i32 1234), %Taken1 ] ; <i32> [#uses=0]
ret i32 0
NotTaken: ; preds = %0
br label %Cont
Taken1: ; preds = %0
%B = icmp eq i32 %A, 0 ; <i1> [#uses=1]
br i1 %B, label %Cont, label %ExitError
ExitError: ; preds = %Taken1
ret i32 12
}
+16 -16
View File
@@ -1,21 +1,21 @@
; PR672
; RUN: llvm-upgrade < %s | llvm-as | lli
; RUN: llvm-as < %s | lli
int %main(){
%f = cast int (int, int*, int)* %check_tail to int*
%res = tail call fastcc int %check_tail( int 10, int* %f,int 10)
ret int %res
define i32 @main() {
%f = bitcast i32 (i32, i32*, i32)* @check_tail to i32* ; <i32*> [#uses=1]
%res = tail call fastcc i32 @check_tail( i32 10, i32* %f, i32 10 ) ; <i32> [#uses=1]
ret i32 %res
}
fastcc int %check_tail(int %x, int* %f, int %g) {
%tmp1 = setgt int %x, 0
br bool %tmp1, label %if-then, label %if-else
if-then:
%fun_ptr = cast int* %f to int(int, int*, int)*
%arg1 = add int %x, -1
%res = tail call fastcc int %fun_ptr( int %arg1, int * %f, int %g)
ret int %res
if-else:
ret int %x
define fastcc i32 @check_tail(i32 %x, i32* %f, i32 %g) {
%tmp1 = icmp sgt i32 %x, 0 ; <i1> [#uses=1]
br i1 %tmp1, label %if-then, label %if-else
if-then: ; preds = %0
%fun_ptr = bitcast i32* %f to i32 (i32, i32*, i32)* ; <i32 (i32, i32*, i32)*> [#uses=1]
%arg1 = add i32 %x, -1 ; <i32> [#uses=1]
%res = tail call fastcc i32 %fun_ptr( i32 %arg1, i32* %f, i32 %g ) ; <i32> [#uses=1]
ret i32 %res
if-else: ; preds = %0
ret i32 %x
}
+6 -8
View File
@@ -1,14 +1,12 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
%.LC0 = internal global [12 x sbyte] c"Hello World\00"
@.LC0 = internal global [12 x i8] c"Hello World\00" ; <[12 x i8]*> [#uses=1]
implementation
declare i32 @puts(i8*)
declare int %puts(sbyte*)
int %main() {
%reg210 = call int %puts( sbyte* getelementptr ([12 x sbyte]* %.LC0, long 0, long 0) )
ret int 0
define i32 @main() {
%reg210 = call i32 @puts( i8* getelementptr ([12 x i8]* @.LC0, i64 0, i64 0) ) ; <i32> [#uses=0]
ret i32 0
}
+10 -14
View File
@@ -1,22 +1,18 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
@X = global i32 7 ; <i32*> [#uses=0]
@msg = internal global [13 x i8] c"Hello World\0A\00" ; <[13 x i8]*> [#uses=1]
%X = global int 7
%msg = internal global [13 x sbyte] c"Hello World\0A\00"
declare void @printf([13 x i8]*, ...)
implementation
declare void %printf([13 x sbyte]*,...)
void %bar() {
call void([13 x sbyte]*,...)* %printf([13 x sbyte]* %msg)
ret void
define void @bar() {
call void ([13 x i8]*, ...)* @printf( [13 x i8]* @msg )
ret void
}
int %main() {
call void %bar()
ret int 0
define i32 @main() {
call void @bar( )
ret i32 0
}
+3 -6
View File
@@ -1,10 +1,7 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
implementation
int %main() {
ret int 0
define i32 @main() {
ret i32 0
}
+7 -7
View File
@@ -1,12 +1,12 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
implementation
define i32 @bar() {
ret i32 0
}
int %bar() { ret int 0 }
int %main() {
%r = call int %bar()
ret int %r
define i32 @main() {
%r = call i32 @bar( ) ; <i32> [#uses=1]
ret i32 %r
}
+32 -35
View File
@@ -1,38 +1,35 @@
; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
; RUN: llvm-as %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
int %main() {
%A = add sbyte 0, 12
%B = sub sbyte %A, 1
%C = mul sbyte %B, %B
%D = div sbyte %C, %C
%E = rem sbyte %D, %D
%F = div ubyte 5, 6
%G = rem ubyte 6, 5
%A = add short 0, 12
%B = sub short %A, 1
%C = mul short %B, %B
%D = div short %C, %C
%E = rem short %D, %D
%F = div ushort 5, 6
%G = rem uint 6, 5
%A = add int 0, 12
%B = sub int %A, 1
%C = mul int %B, %B
%D = div int %C, %C
%E = rem int %D, %D
%F = div uint 5, 6
%G1 = rem uint 6, 5
%A = add long 0, 12
%B = sub long %A, 1
%C = mul long %B, %B
%D = div long %C, %C
%E = rem long %D, %D
%F = div ulong 5, 6
%G = rem ulong 6, 5
ret int 0
define i32 @main() {
%A = add i8 0, 12 ; <i8> [#uses=1]
%B = sub i8 %A, 1 ; <i8> [#uses=2]
%C = mul i8 %B, %B ; <i8> [#uses=2]
%D = sdiv i8 %C, %C ; <i8> [#uses=2]
%E = srem i8 %D, %D ; <i8> [#uses=0]
%F = udiv i8 5, 6 ; <i8> [#uses=0]
%G = urem i8 6, 5 ; <i8> [#uses=0]
%A.upgrd.1 = add i16 0, 12 ; <i16> [#uses=1]
%B.upgrd.2 = sub i16 %A.upgrd.1, 1 ; <i16> [#uses=2]
%C.upgrd.3 = mul i16 %B.upgrd.2, %B.upgrd.2 ; <i16> [#uses=2]
%D.upgrd.4 = sdiv i16 %C.upgrd.3, %C.upgrd.3 ; <i16> [#uses=2]
%E.upgrd.5 = srem i16 %D.upgrd.4, %D.upgrd.4 ; <i16> [#uses=0]
%F.upgrd.6 = udiv i16 5, 6 ; <i16> [#uses=0]
%G.upgrd.7 = urem i32 6, 5 ; <i32> [#uses=0]
%A.upgrd.8 = add i32 0, 12 ; <i32> [#uses=1]
%B.upgrd.9 = sub i32 %A.upgrd.8, 1 ; <i32> [#uses=2]
%C.upgrd.10 = mul i32 %B.upgrd.9, %B.upgrd.9 ; <i32> [#uses=2]
%D.upgrd.11 = sdiv i32 %C.upgrd.10, %C.upgrd.10 ; <i32> [#uses=2]
%E.upgrd.12 = srem i32 %D.upgrd.11, %D.upgrd.11 ; <i32> [#uses=0]
%F.upgrd.13 = udiv i32 5, 6 ; <i32> [#uses=0]
%G1 = urem i32 6, 5 ; <i32> [#uses=0]
%A.upgrd.14 = add i64 0, 12 ; <i64> [#uses=1]
%B.upgrd.15 = sub i64 %A.upgrd.14, 1 ; <i64> [#uses=2]
%C.upgrd.16 = mul i64 %B.upgrd.15, %B.upgrd.15 ; <i64> [#uses=2]
%D.upgrd.17 = sdiv i64 %C.upgrd.16, %C.upgrd.16 ; <i64> [#uses=2]
%E.upgrd.18 = srem i64 %D.upgrd.17, %D.upgrd.17 ; <i64> [#uses=0]
%F.upgrd.19 = udiv i64 5, 6 ; <i64> [#uses=0]
%G.upgrd.20 = urem i64 6, 5 ; <i64> [#uses=0]
ret i32 0
}
+8 -7
View File
@@ -1,12 +1,13 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
; test unconditional branch
int %main() {
define i32 @main() {
br label %Test
Test:
%X = seteq int 0, 4
br bool %X, label %Test, label %Label
Label:
ret int 0
Test: ; preds = %Test, %0
%X = icmp eq i32 0, 4 ; <i1> [#uses=1]
br i1 %X, label %Test, label %Label
Label: ; preds = %Test
ret i32 0
}
+13 -13
View File
@@ -1,22 +1,22 @@
; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
declare void @exit(i32)
declare void %exit(int)
int %test(sbyte %C, short %S) {
%X = cast short %S to ubyte
%Y = cast ubyte %X to int
ret int %Y
define i32 @test(i8 %C, i16 %S) {
%X = trunc i16 %S to i8 ; <i8> [#uses=1]
%Y = zext i8 %X to i32 ; <i32> [#uses=1]
ret i32 %Y
}
void %FP(void(int) * %F) {
%X = call int %test(sbyte 123, short 1024)
call void %F(int %X)
define void @FP(void (i32)* %F) {
%X = call i32 @test( i8 123, i16 1024 ) ; <i32> [#uses=1]
call void %F( i32 %X )
ret void
}
int %main() {
call void %FP(void(int)* %exit)
ret int 1
define i32 @main() {
call void @FP( void (i32)* @exit )
ret i32 1
}
+105 -131
View File
@@ -1,136 +1,110 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
int %foo() {
ret int 0
define i32 @foo() {
ret i32 0
}
int %main() {
; cast bool to ...
cast bool true to bool
cast bool true to ubyte
cast bool true to sbyte
cast bool true to short
cast bool true to ushort
cast bool true to int
cast bool true to uint
cast bool true to long
cast bool true to ulong
cast bool true to float
cast bool true to double
; cast sbyte to ...
cast sbyte 0 to bool
cast sbyte 1 to bool
cast sbyte 0 to sbyte
cast sbyte -1 to ubyte
cast sbyte 4 to short
cast sbyte 4 to ushort
cast sbyte 4 to long
cast sbyte 4 to ulong
cast sbyte 4 to float
cast sbyte 4 to double
; cast ubyte to ...
cast ubyte 0 to bool
cast ubyte 1 to bool
cast ubyte 0 to sbyte
cast ubyte 1 to ubyte
cast ubyte 4 to short
cast ubyte 4 to ushort
cast ubyte 4 to long
cast ubyte 4 to ulong
cast ubyte 0 to float
cast ubyte 0 to double
; cast short to ...
cast short 1 to bool
cast short -1 to sbyte
cast short 255 to ubyte
cast short 0 to short
cast short 0 to ushort
cast short 0 to long
cast short 0 to ulong
cast short 0 to float
cast short 0 to double
; cast ushort to ...
cast ushort 1 to bool
cast ushort 1 to sbyte
cast ushort 255 to ubyte
cast ushort 0 to short
cast ushort 0 to ushort
cast ushort 0 to long
cast ushort 0 to ulong
cast ushort 0 to float
cast ushort 0 to double
; cast int to ...
cast int 6 to bool
cast int -6 to sbyte
cast int 6 to ubyte
cast int 6 to short
cast int 0 to int
cast int 0 to long
cast int 0 to ulong
cast int 0 to float
cast int 0 to double
; cast uint to ...
cast uint 6 to bool
cast uint 7 to sbyte
cast uint 8 to ubyte
cast uint 9 to short
cast uint 10 to int
cast uint 0 to long
cast uint 0 to ulong
cast uint 0 to float
cast uint 0 to double
; cast long to ...
cast long 0 to bool
cast long 0 to sbyte
cast long 0 to ubyte
cast long 0 to short
cast long 0 to ushort
cast long 0 to int
cast long 0 to uint
cast long 0 to long
cast long 0 to ulong
cast long 0 to float
cast long 0 to double
; cast ulong to ...
cast ulong 1 to bool
cast ulong 1 to sbyte
cast ulong 1 to ubyte
cast ulong 1 to short
cast ulong 1 to ushort
cast ulong 1 to int
cast ulong 1 to uint
cast ulong 1 to long
cast ulong 1 to ulong
cast ulong 1 to float
cast ulong 0 to double
; cast float to ...
;cast float 0.0 to bool
cast float 0.0 to float
cast float 0.0 to double
; cast double to ...
;cast double 0.0 to bool
cast double 0.0 to sbyte
cast double 0.0 to ubyte
cast double 0.0 to short
cast double 0.0 to ushort
cast double 0.0 to int
cast double 0.0 to uint
cast double 0.0 to long
;cast double 0.0 to ulong
cast double 0.0 to float
cast double 0.0 to double
ret int 0
define i32 @main() {
icmp ne i1 true, false ; <i1>:1 [#uses=0]
zext i1 true to i8 ; <i8>:2 [#uses=0]
zext i1 true to i8 ; <i8>:3 [#uses=0]
zext i1 true to i16 ; <i16>:4 [#uses=0]
zext i1 true to i16 ; <i16>:5 [#uses=0]
zext i1 true to i32 ; <i32>:6 [#uses=0]
zext i1 true to i32 ; <i32>:7 [#uses=0]
zext i1 true to i64 ; <i64>:8 [#uses=0]
zext i1 true to i64 ; <i64>:9 [#uses=0]
uitofp i1 true to float ; <float>:10 [#uses=0]
uitofp i1 true to double ; <double>:11 [#uses=0]
icmp ne i8 0, 0 ; <i1>:12 [#uses=0]
icmp ne i8 1, 0 ; <i1>:13 [#uses=0]
bitcast i8 0 to i8 ; <i8>:14 [#uses=0]
bitcast i8 -1 to i8 ; <i8>:15 [#uses=0]
sext i8 4 to i16 ; <i16>:16 [#uses=0]
sext i8 4 to i16 ; <i16>:17 [#uses=0]
sext i8 4 to i64 ; <i64>:18 [#uses=0]
sext i8 4 to i64 ; <i64>:19 [#uses=0]
sitofp i8 4 to float ; <float>:20 [#uses=0]
sitofp i8 4 to double ; <double>:21 [#uses=0]
icmp ne i8 0, 0 ; <i1>:22 [#uses=0]
icmp ne i8 1, 0 ; <i1>:23 [#uses=0]
bitcast i8 0 to i8 ; <i8>:24 [#uses=0]
bitcast i8 1 to i8 ; <i8>:25 [#uses=0]
zext i8 4 to i16 ; <i16>:26 [#uses=0]
zext i8 4 to i16 ; <i16>:27 [#uses=0]
zext i8 4 to i64 ; <i64>:28 [#uses=0]
zext i8 4 to i64 ; <i64>:29 [#uses=0]
uitofp i8 0 to float ; <float>:30 [#uses=0]
uitofp i8 0 to double ; <double>:31 [#uses=0]
icmp ne i16 1, 0 ; <i1>:32 [#uses=0]
trunc i16 -1 to i8 ; <i8>:33 [#uses=0]
trunc i16 255 to i8 ; <i8>:34 [#uses=0]
bitcast i16 0 to i16 ; <i16>:35 [#uses=0]
bitcast i16 0 to i16 ; <i16>:36 [#uses=0]
sext i16 0 to i64 ; <i64>:37 [#uses=0]
sext i16 0 to i64 ; <i64>:38 [#uses=0]
sitofp i16 0 to float ; <float>:39 [#uses=0]
sitofp i16 0 to double ; <double>:40 [#uses=0]
icmp ne i16 1, 0 ; <i1>:41 [#uses=0]
trunc i16 1 to i8 ; <i8>:42 [#uses=0]
trunc i16 255 to i8 ; <i8>:43 [#uses=0]
bitcast i16 0 to i16 ; <i16>:44 [#uses=0]
bitcast i16 0 to i16 ; <i16>:45 [#uses=0]
zext i16 0 to i64 ; <i64>:46 [#uses=0]
zext i16 0 to i64 ; <i64>:47 [#uses=0]
uitofp i16 0 to float ; <float>:48 [#uses=0]
uitofp i16 0 to double ; <double>:49 [#uses=0]
icmp ne i32 6, 0 ; <i1>:50 [#uses=0]
trunc i32 -6 to i8 ; <i8>:51 [#uses=0]
trunc i32 6 to i8 ; <i8>:52 [#uses=0]
trunc i32 6 to i16 ; <i16>:53 [#uses=0]
bitcast i32 0 to i32 ; <i32>:54 [#uses=0]
sext i32 0 to i64 ; <i64>:55 [#uses=0]
sext i32 0 to i64 ; <i64>:56 [#uses=0]
sitofp i32 0 to float ; <float>:57 [#uses=0]
sitofp i32 0 to double ; <double>:58 [#uses=0]
icmp ne i32 6, 0 ; <i1>:59 [#uses=0]
trunc i32 7 to i8 ; <i8>:60 [#uses=0]
trunc i32 8 to i8 ; <i8>:61 [#uses=0]
trunc i32 9 to i16 ; <i16>:62 [#uses=0]
bitcast i32 10 to i32 ; <i32>:63 [#uses=0]
zext i32 0 to i64 ; <i64>:64 [#uses=0]
zext i32 0 to i64 ; <i64>:65 [#uses=0]
uitofp i32 0 to float ; <float>:66 [#uses=0]
uitofp i32 0 to double ; <double>:67 [#uses=0]
icmp ne i64 0, 0 ; <i1>:68 [#uses=0]
trunc i64 0 to i8 ; <i8>:69 [#uses=0]
trunc i64 0 to i8 ; <i8>:70 [#uses=0]
trunc i64 0 to i16 ; <i16>:71 [#uses=0]
trunc i64 0 to i16 ; <i16>:72 [#uses=0]
trunc i64 0 to i32 ; <i32>:73 [#uses=0]
trunc i64 0 to i32 ; <i32>:74 [#uses=0]
bitcast i64 0 to i64 ; <i64>:75 [#uses=0]
bitcast i64 0 to i64 ; <i64>:76 [#uses=0]
sitofp i64 0 to float ; <float>:77 [#uses=0]
sitofp i64 0 to double ; <double>:78 [#uses=0]
icmp ne i64 1, 0 ; <i1>:79 [#uses=0]
trunc i64 1 to i8 ; <i8>:80 [#uses=0]
trunc i64 1 to i8 ; <i8>:81 [#uses=0]
trunc i64 1 to i16 ; <i16>:82 [#uses=0]
trunc i64 1 to i16 ; <i16>:83 [#uses=0]
trunc i64 1 to i32 ; <i32>:84 [#uses=0]
trunc i64 1 to i32 ; <i32>:85 [#uses=0]
bitcast i64 1 to i64 ; <i64>:86 [#uses=0]
bitcast i64 1 to i64 ; <i64>:87 [#uses=0]
uitofp i64 1 to float ; <float>:88 [#uses=0]
uitofp i64 0 to double ; <double>:89 [#uses=0]
bitcast float 0.000000e+00 to float ; <float>:90 [#uses=0]
fpext float 0.000000e+00 to double ; <double>:91 [#uses=0]
fptosi double 0.000000e+00 to i8 ; <i8>:92 [#uses=0]
fptoui double 0.000000e+00 to i8 ; <i8>:93 [#uses=0]
fptosi double 0.000000e+00 to i16 ; <i16>:94 [#uses=0]
fptoui double 0.000000e+00 to i16 ; <i16>:95 [#uses=0]
fptosi double 0.000000e+00 to i32 ; <i32>:96 [#uses=0]
fptoui double 0.000000e+00 to i32 ; <i32>:97 [#uses=0]
fptosi double 0.000000e+00 to i64 ; <i64>:98 [#uses=0]
fptrunc double 0.000000e+00 to float ; <float>:99 [#uses=0]
bitcast double 0.000000e+00 to double ; <double>:100 [#uses=0]
ret i32 0
}
+6 -7
View File
@@ -1,14 +1,13 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
; This tests to make sure that we can evaluate weird constant expressions
%A = global int 5
%B = global int 6
implementation
@A = global i32 5 ; <i32*> [#uses=1]
@B = global i32 6 ; <i32*> [#uses=1]
int %main() {
%A = or bool false, setlt (int* %A, int* %B) ; Which is lower in memory?
ret int 0
define i32 @main() {
%A = or i1 false, icmp slt (i32* @A, i32* @B) ; <i1> [#uses=0]
ret i32 0
}
+17 -17
View File
@@ -1,24 +1,24 @@
; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
double %test(double* %DP, double %Arg) {
%D = load double* %DP
%V = add double %D, 1.0
%W = sub double %V, %V
%X = mul double %W, %W
%Y = div double %X, %X
%Z = rem double %Y, %Y
%Z1 = div double %Z, %W
%Q = add double %Z, %Arg
%R = cast double %Q to double
define double @test(double* %DP, double %Arg) {
%D = load double* %DP ; <double> [#uses=1]
%V = add double %D, 1.000000e+00 ; <double> [#uses=2]
%W = sub double %V, %V ; <double> [#uses=3]
%X = mul double %W, %W ; <double> [#uses=2]
%Y = fdiv double %X, %X ; <double> [#uses=2]
%Z = frem double %Y, %Y ; <double> [#uses=3]
%Z1 = fdiv double %Z, %W ; <double> [#uses=0]
%Q = add double %Z, %Arg ; <double> [#uses=1]
%R = bitcast double %Q to double ; <double> [#uses=1]
store double %R, double* %DP
ret double %Z
}
int %main() {
%X = alloca double
store double 0.0, double* %X
call double %test(double* %X, double 2.0)
ret int 0
define i32 @main() {
%X = alloca double ; <double*> [#uses=2]
store double 0.000000e+00, double* %X
call double @test( double* %X, double 2.000000e+00 ) ; <double>:1 [#uses=0]
ret i32 0
}
+24 -29
View File
@@ -1,37 +1,32 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
void %test(sbyte* %P, short* %P, int* %P, long* %P) {
%V = load sbyte* %P
store sbyte %V, sbyte* %P
%V = load short* %P
store short %V, short* %P
%V = load int* %P
store int %V, int* %P
%V = load long* %P
store long %V, long* %P
define void @test(i8* %P, i16* %P.upgrd.1, i32* %P.upgrd.2, i64* %P.upgrd.3) {
%V = load i8* %P ; <i8> [#uses=1]
store i8 %V, i8* %P
%V.upgrd.4 = load i16* %P.upgrd.1 ; <i16> [#uses=1]
store i16 %V.upgrd.4, i16* %P.upgrd.1
%V.upgrd.5 = load i32* %P.upgrd.2 ; <i32> [#uses=1]
store i32 %V.upgrd.5, i32* %P.upgrd.2
%V.upgrd.6 = load i64* %P.upgrd.3 ; <i64> [#uses=1]
store i64 %V.upgrd.6, i64* %P.upgrd.3
ret void
}
uint %varalloca(uint %Size) {
%X = alloca uint, uint %Size ;; Variable sized alloca
store uint %Size, uint* %X
%Y = load uint* %X
ret uint %Y
define i32 @varalloca(i32 %Size) {
;; Variable sized alloca
%X = alloca i32, i32 %Size ; <i32*> [#uses=2]
store i32 %Size, i32* %X
%Y = load i32* %X ; <i32> [#uses=1]
ret i32 %Y
}
int %main() {
%A = alloca sbyte
%B = alloca short
%C = alloca int
%D = alloca long
call void %test(sbyte* %A, short* %B, int* %C, long* %D)
call uint %varalloca(uint 7)
ret int 0
define i32 @main() {
%A = alloca i8 ; <i8*> [#uses=1]
%B = alloca i16 ; <i16*> [#uses=1]
%C = alloca i32 ; <i32*> [#uses=1]
%D = alloca i64 ; <i64*> [#uses=1]
call void @test( i8* %A, i16* %B, i32* %C, i64* %D )
call i32 @varalloca( i32 7 ) ; <i32>:1 [#uses=0]
ret i32 0
}
+16 -20
View File
@@ -1,23 +1,19 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
int %main() {
%A = and sbyte 4, 8
%B = or sbyte %A, 7
%C = xor sbyte %B, %A
%A = and short 4, 8
%B = or short %A, 7
%C = xor short %B, %A
%A = and int 4, 8
%B = or int %A, 7
%C = xor int %B, %A
%A = and long 4, 8
%B = or long %A, 7
%C = xor long %B, %A
ret int 0
define i32 @main() {
%A = and i8 4, 8 ; <i8> [#uses=2]
%B = or i8 %A, 7 ; <i8> [#uses=1]
%C = xor i8 %B, %A ; <i8> [#uses=0]
%A.upgrd.1 = and i16 4, 8 ; <i16> [#uses=2]
%B.upgrd.2 = or i16 %A.upgrd.1, 7 ; <i16> [#uses=1]
%C.upgrd.3 = xor i16 %B.upgrd.2, %A.upgrd.1 ; <i16> [#uses=0]
%A.upgrd.4 = and i32 4, 8 ; <i32> [#uses=2]
%B.upgrd.5 = or i32 %A.upgrd.4, 7 ; <i32> [#uses=1]
%C.upgrd.6 = xor i32 %B.upgrd.5, %A.upgrd.4 ; <i32> [#uses=0]
%A.upgrd.7 = and i64 4, 8 ; <i64> [#uses=2]
%B.upgrd.8 = or i64 %A.upgrd.7, 7 ; <i64> [#uses=1]
%C.upgrd.9 = xor i64 %B.upgrd.8, %A.upgrd.7 ; <i64> [#uses=0]
ret i32 0
}
+11 -9
View File
@@ -1,13 +1,15 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
int %main() {
define i32 @main() {
; <label>:0
br label %Loop
Loop:
%I = phi int [0, %0], [%i2, %Loop]
%i2 = add int %I, 1
%C = seteq int %i2, 10
br bool %C, label %Out, label %Loop
Out:
ret int 0
Loop: ; preds = %Loop, %0
%I = phi i32 [ 0, %0 ], [ %i2, %Loop ] ; <i32> [#uses=1]
%i2 = add i32 %I, 1 ; <i32> [#uses=2]
%C = icmp eq i32 %i2, 10 ; <i1> [#uses=1]
br i1 %C, label %Out, label %Loop
Out: ; preds = %Loop
ret i32 0
}
+11 -11
View File
@@ -1,14 +1,14 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
int %main() {
%X = malloc int ; constant size
%Y = malloc int, uint 100 ; constant size
%u = add uint 1, 2
%Z = malloc int, uint %u ; variable size
free int* %X
free int* %Y
free int* %Z
ret int 0
define i32 @main() {
%X = malloc i32 ; <i32*> [#uses=1]
%Y = malloc i32, i32 100 ; <i32*> [#uses=1]
%u = add i32 1, 2 ; <i32> [#uses=1]
%Z = malloc i32, i32 %u ; <i32*> [#uses=1]
free i32* %X
free i32* %Y
free i32* %Z
ret i32 0
}
+21 -18
View File
@@ -1,32 +1,35 @@
; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
; test phi node
@Y = global i32 6 ; <i32*> [#uses=1]
%Y = global int 6
void %blah(int *%X) {
define void @blah(i32* %X) {
; <label>:0
br label %T
T:
phi int* [%X, %0], [%Y, %Dead]
T: ; preds = %Dead, %0
phi i32* [ %X, %0 ], [ @Y, %Dead ] ; <i32*>:1 [#uses=0]
ret void
Dead:
Dead: ; No predecessors!
br label %T
}
int %test(bool %C) {
br bool %C, label %T, label %T
T:
%X = phi int [123, %0], [123, %0]
ret int %X
define i32 @test(i1 %C) {
; <label>:0
br i1 %C, label %T, label %T
T: ; preds = %0, %0
%X = phi i32 [ 123, %0 ], [ 123, %0 ] ; <i32> [#uses=1]
ret i32 %X
}
int %main() {
define i32 @main() {
; <label>:0
br label %Test
Test:
%X = phi int [0, %0], [%Y, %Dead]
ret int %X
Dead:
%Y = shr int 12, ubyte 4
Test: ; preds = %Dead, %0
%X = phi i32 [ 0, %0 ], [ %Y, %Dead ] ; <i32> [#uses=1]
ret i32 %X
Dead: ; No predecessors!
%Y = ashr i32 12, 4 ; <i32> [#uses=1]
br label %Test
}
+43 -12
View File
@@ -1,16 +1,47 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
; test return instructions
define void @test1() {
ret void
}
void %test1() { ret void }
sbyte %test2() { ret sbyte 1 }
ubyte %test3() { ret ubyte 1 }
short %test4() { ret short -1 }
ushort %test5() { ret ushort 65535 }
int %main() { ret int 0 }
uint %test6() { ret uint 4 }
long %test7() { ret long 0 }
ulong %test8() { ret ulong 0 }
float %test9() { ret float 1.0 }
double %test10() { ret double 2.0 }
define i8 @test2() {
ret i8 1
}
define i8 @test3() {
ret i8 1
}
define i16 @test4() {
ret i16 -1
}
define i16 @test5() {
ret i16 -1
}
define i32 @main() {
ret i32 0
}
define i32 @test6() {
ret i32 4
}
define i64 @test7() {
ret i64 0
}
define i64 @test8() {
ret i64 0
}
define float @test9() {
ret float 1.000000e+00
}
define double @test10() {
ret double 2.000000e+00
}
+21 -19
View File
@@ -1,23 +1,25 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
int %main() {
%double1 = add double 0.0, 0.0
%double2 = add double 0.0, 0.0
%float1 = add float 0.0, 0.0
%float2 = add float 0.0, 0.0
%test49 = seteq float %float1, %float2
%test50 = setge float %float1, %float2
%test51 = setgt float %float1, %float2
%test52 = setle float %float1, %float2
%test53 = setlt float %float1, %float2
%test54 = setne float %float1, %float2
%test55 = seteq double %double1, %double2
%test56 = setge double %double1, %double2
%test57 = setgt double %double1, %double2
%test58 = setle double %double1, %double2
%test59 = setlt double %double1, %double2
%test60 = setne double %double1, %double2
ret int 0
define i32 @main() {
%double1 = add double 0.000000e+00, 0.000000e+00 ; <double> [#uses=6]
%double2 = add double 0.000000e+00, 0.000000e+00 ; <double> [#uses=6]
%float1 = add float 0.000000e+00, 0.000000e+00 ; <float> [#uses=6]
%float2 = add float 0.000000e+00, 0.000000e+00 ; <float> [#uses=6]
%test49 = fcmp oeq float %float1, %float2 ; <i1> [#uses=0]
%test50 = fcmp oge float %float1, %float2 ; <i1> [#uses=0]
%test51 = fcmp ogt float %float1, %float2 ; <i1> [#uses=0]
%test52 = fcmp ole float %float1, %float2 ; <i1> [#uses=0]
%test53 = fcmp olt float %float1, %float2 ; <i1> [#uses=0]
%test54 = fcmp une float %float1, %float2 ; <i1> [#uses=0]
%test55 = fcmp oeq double %double1, %double2 ; <i1> [#uses=0]
%test56 = fcmp oge double %double1, %double2 ; <i1> [#uses=0]
%test57 = fcmp ogt double %double1, %double2 ; <i1> [#uses=0]
%test58 = fcmp ole double %double1, %double2 ; <i1> [#uses=0]
%test59 = fcmp olt double %double1, %double2 ; <i1> [#uses=0]
%test60 = fcmp une double %double1, %double2 ; <i1> [#uses=0]
ret i32 0
}
+67 -68
View File
@@ -1,71 +1,70 @@
; RUN: llvm-upgrade < %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
int %main() {
%int1 = add int 0, 0
%int2 = add int 0, 0
%long1 = add long 0, 0
%long2 = add long 0, 0
%sbyte1 = add sbyte 0, 0
%sbyte2 = add sbyte 0, 0
%short1 = add short 0, 0
%short2 = add short 0, 0
%ubyte1 = add ubyte 0, 0
%ubyte2 = add ubyte 0, 0
%uint1 = add uint 0, 0
%uint2 = add uint 0, 0
%ulong1 = add ulong 0, 0
%ulong2 = add ulong 0, 0
%ushort1 = add ushort 0, 0
%ushort2 = add ushort 0, 0
%test1 = seteq ubyte %ubyte1, %ubyte2
%test2 = setge ubyte %ubyte1, %ubyte2
%test3 = setgt ubyte %ubyte1, %ubyte2
%test4 = setle ubyte %ubyte1, %ubyte2
%test5 = setlt ubyte %ubyte1, %ubyte2
%test6 = setne ubyte %ubyte1, %ubyte2
%test7 = seteq ushort %ushort1, %ushort2
%test8 = setge ushort %ushort1, %ushort2
%test9 = setgt ushort %ushort1, %ushort2
%test10 = setle ushort %ushort1, %ushort2
%test11 = setlt ushort %ushort1, %ushort2
%test12 = setne ushort %ushort1, %ushort2
%test13 = seteq uint %uint1, %uint2
%test14 = setge uint %uint1, %uint2
%test15 = setgt uint %uint1, %uint2
%test16 = setle uint %uint1, %uint2
%test17 = setlt uint %uint1, %uint2
%test18 = setne uint %uint1, %uint2
%test19 = seteq ulong %ulong1, %ulong2
%test20 = setge ulong %ulong1, %ulong2
%test21 = setgt ulong %ulong1, %ulong2
%test22 = setle ulong %ulong1, %ulong2
%test23 = setlt ulong %ulong1, %ulong2
%test24 = setne ulong %ulong1, %ulong2
%test25 = seteq sbyte %sbyte1, %sbyte2
%test26 = setge sbyte %sbyte1, %sbyte2
%test27 = setgt sbyte %sbyte1, %sbyte2
%test28 = setle sbyte %sbyte1, %sbyte2
%test29 = setlt sbyte %sbyte1, %sbyte2
%test30 = setne sbyte %sbyte1, %sbyte2
%test31 = seteq short %short1, %short2
%test32 = setge short %short1, %short2
%test33 = setgt short %short1, %short2
%test34 = setle short %short1, %short2
%test35 = setlt short %short1, %short2
%test36 = setne short %short1, %short2
%test37 = seteq int %int1, %int2
%test38 = setge int %int1, %int2
%test39 = setgt int %int1, %int2
%test40 = setle int %int1, %int2
%test41 = setlt int %int1, %int2
%test42 = setne int %int1, %int2
%test43 = seteq long %long1, %long2
%test44 = setge long %long1, %long2
%test45 = setgt long %long1, %long2
%test46 = setle long %long1, %long2
%test47 = setlt long %long1, %long2
%test48 = setne long %long1, %long2
ret int 0
define i32 @main() {
%int1 = add i32 0, 0 ; <i32> [#uses=6]
%int2 = add i32 0, 0 ; <i32> [#uses=6]
%long1 = add i64 0, 0 ; <i64> [#uses=6]
%long2 = add i64 0, 0 ; <i64> [#uses=6]
%sbyte1 = add i8 0, 0 ; <i8> [#uses=6]
%sbyte2 = add i8 0, 0 ; <i8> [#uses=6]
%short1 = add i16 0, 0 ; <i16> [#uses=6]
%short2 = add i16 0, 0 ; <i16> [#uses=6]
%ubyte1 = add i8 0, 0 ; <i8> [#uses=6]
%ubyte2 = add i8 0, 0 ; <i8> [#uses=6]
%uint1 = add i32 0, 0 ; <i32> [#uses=6]
%uint2 = add i32 0, 0 ; <i32> [#uses=6]
%ulong1 = add i64 0, 0 ; <i64> [#uses=6]
%ulong2 = add i64 0, 0 ; <i64> [#uses=6]
%ushort1 = add i16 0, 0 ; <i16> [#uses=6]
%ushort2 = add i16 0, 0 ; <i16> [#uses=6]
%test1 = icmp eq i8 %ubyte1, %ubyte2 ; <i1> [#uses=0]
%test2 = icmp uge i8 %ubyte1, %ubyte2 ; <i1> [#uses=0]
%test3 = icmp ugt i8 %ubyte1, %ubyte2 ; <i1> [#uses=0]
%test4 = icmp ule i8 %ubyte1, %ubyte2 ; <i1> [#uses=0]
%test5 = icmp ult i8 %ubyte1, %ubyte2 ; <i1> [#uses=0]
%test6 = icmp ne i8 %ubyte1, %ubyte2 ; <i1> [#uses=0]
%test7 = icmp eq i16 %ushort1, %ushort2 ; <i1> [#uses=0]
%test8 = icmp uge i16 %ushort1, %ushort2 ; <i1> [#uses=0]
%test9 = icmp ugt i16 %ushort1, %ushort2 ; <i1> [#uses=0]
%test10 = icmp ule i16 %ushort1, %ushort2 ; <i1> [#uses=0]
%test11 = icmp ult i16 %ushort1, %ushort2 ; <i1> [#uses=0]
%test12 = icmp ne i16 %ushort1, %ushort2 ; <i1> [#uses=0]
%test13 = icmp eq i32 %uint1, %uint2 ; <i1> [#uses=0]
%test14 = icmp uge i32 %uint1, %uint2 ; <i1> [#uses=0]
%test15 = icmp ugt i32 %uint1, %uint2 ; <i1> [#uses=0]
%test16 = icmp ule i32 %uint1, %uint2 ; <i1> [#uses=0]
%test17 = icmp ult i32 %uint1, %uint2 ; <i1> [#uses=0]
%test18 = icmp ne i32 %uint1, %uint2 ; <i1> [#uses=0]
%test19 = icmp eq i64 %ulong1, %ulong2 ; <i1> [#uses=0]
%test20 = icmp uge i64 %ulong1, %ulong2 ; <i1> [#uses=0]
%test21 = icmp ugt i64 %ulong1, %ulong2 ; <i1> [#uses=0]
%test22 = icmp ule i64 %ulong1, %ulong2 ; <i1> [#uses=0]
%test23 = icmp ult i64 %ulong1, %ulong2 ; <i1> [#uses=0]
%test24 = icmp ne i64 %ulong1, %ulong2 ; <i1> [#uses=0]
%test25 = icmp eq i8 %sbyte1, %sbyte2 ; <i1> [#uses=0]
%test26 = icmp sge i8 %sbyte1, %sbyte2 ; <i1> [#uses=0]
%test27 = icmp sgt i8 %sbyte1, %sbyte2 ; <i1> [#uses=0]
%test28 = icmp sle i8 %sbyte1, %sbyte2 ; <i1> [#uses=0]
%test29 = icmp slt i8 %sbyte1, %sbyte2 ; <i1> [#uses=0]
%test30 = icmp ne i8 %sbyte1, %sbyte2 ; <i1> [#uses=0]
%test31 = icmp eq i16 %short1, %short2 ; <i1> [#uses=0]
%test32 = icmp sge i16 %short1, %short2 ; <i1> [#uses=0]
%test33 = icmp sgt i16 %short1, %short2 ; <i1> [#uses=0]
%test34 = icmp sle i16 %short1, %short2 ; <i1> [#uses=0]
%test35 = icmp slt i16 %short1, %short2 ; <i1> [#uses=0]
%test36 = icmp ne i16 %short1, %short2 ; <i1> [#uses=0]
%test37 = icmp eq i32 %int1, %int2 ; <i1> [#uses=0]
%test38 = icmp sge i32 %int1, %int2 ; <i1> [#uses=0]
%test39 = icmp sgt i32 %int1, %int2 ; <i1> [#uses=0]
%test40 = icmp sle i32 %int1, %int2 ; <i1> [#uses=0]
%test41 = icmp slt i32 %int1, %int2 ; <i1> [#uses=0]
%test42 = icmp ne i32 %int1, %int2 ; <i1> [#uses=0]
%test43 = icmp eq i64 %long1, %long2 ; <i1> [#uses=0]
%test44 = icmp sge i64 %long1, %long2 ; <i1> [#uses=0]
%test45 = icmp sgt i64 %long1, %long2 ; <i1> [#uses=0]
%test46 = icmp sle i64 %long1, %long2 ; <i1> [#uses=0]
%test47 = icmp slt i64 %long1, %long2 ; <i1> [#uses=0]
%test48 = icmp ne i64 %long1, %long2 ; <i1> [#uses=0]
ret i32 0
}
+30 -37
View File
@@ -1,40 +1,33 @@
; RUN: llvm-upgrade %s | llvm-as -f -o %t.bc
; RUN: llvm-as < %s -f -o %t.bc
; RUN: lli %t.bc > /dev/null
; test shifts
int %main() {
%shamt = add ubyte 0, 1
; Left shifts...
%t1.s = shl int 1, ubyte %shamt
%t2.s = shl int 1, ubyte 4
%t1 = shl uint 1, ubyte %shamt
%t2 = shl uint 1, ubyte 5
;%t1 = shl long 1, ubyte %shamt
%t2.s = shl long 1, ubyte 4
;%t1 = shl ulong 1, ubyte %shamt
%t2 = shl ulong 1, ubyte 5
; Right shifts...
%tr1.s = shr int 1, ubyte %shamt
%tr2.s = shr int 1, ubyte 4
%tr1 = shr uint 1, ubyte %shamt
%tr2 = shr uint 1, ubyte 5
;%tr1 = shr long 1, ubyte %shamt
%tr1.l = shr long 1, ubyte 4
%tr2.l = shr long 1, ubyte %shamt
%tr3.l = shl long 1, ubyte 4
%tr4.l = shl long 1, ubyte %shamt
;%t1 = shr ulong 1, ubyte %shamt
%tr1.u = shr ulong 1, ubyte 5
%tr2.u = shr ulong 1, ubyte %shamt
%tr3.u = shl ulong 1, ubyte 5
%tr4.u = shl ulong 1, ubyte %shamt
ret int 0
define i32 @main() {
%shamt = add i8 0, 1 ; <i8> [#uses=8]
%shift.upgrd.1 = zext i8 %shamt to i32 ; <i32> [#uses=1]
%t1.s = shl i32 1, %shift.upgrd.1 ; <i32> [#uses=0]
%t2.s = shl i32 1, 4 ; <i32> [#uses=0]
%shift.upgrd.2 = zext i8 %shamt to i32 ; <i32> [#uses=1]
%t1 = shl i32 1, %shift.upgrd.2 ; <i32> [#uses=0]
%t2 = shl i32 1, 5 ; <i32> [#uses=0]
%t2.s.upgrd.3 = shl i64 1, 4 ; <i64> [#uses=0]
%t2.upgrd.4 = shl i64 1, 5 ; <i64> [#uses=0]
%shift.upgrd.5 = zext i8 %shamt to i32 ; <i32> [#uses=1]
%tr1.s = ashr i32 1, %shift.upgrd.5 ; <i32> [#uses=0]
%tr2.s = ashr i32 1, 4 ; <i32> [#uses=0]
%shift.upgrd.6 = zext i8 %shamt to i32 ; <i32> [#uses=1]
%tr1 = lshr i32 1, %shift.upgrd.6 ; <i32> [#uses=0]
%tr2 = lshr i32 1, 5 ; <i32> [#uses=0]
%tr1.l = ashr i64 1, 4 ; <i64> [#uses=0]
%shift.upgrd.7 = zext i8 %shamt to i64 ; <i64> [#uses=1]
%tr2.l = ashr i64 1, %shift.upgrd.7 ; <i64> [#uses=0]
%tr3.l = shl i64 1, 4 ; <i64> [#uses=0]
%shift.upgrd.8 = zext i8 %shamt to i64 ; <i64> [#uses=1]
%tr4.l = shl i64 1, %shift.upgrd.8 ; <i64> [#uses=0]
%tr1.u = lshr i64 1, 5 ; <i64> [#uses=0]
%shift.upgrd.9 = zext i8 %shamt to i64 ; <i64> [#uses=1]
%tr2.u = lshr i64 1, %shift.upgrd.9 ; <i64> [#uses=0]
%tr3.u = shl i64 1, 5 ; <i64> [#uses=0]
%shift.upgrd.10 = zext i8 %shamt to i64 ; <i64> [#uses=1]
%tr4.u = shl i64 1, %shift.upgrd.10 ; <i64> [#uses=0]
ret i32 0
}