Skip to content

Commit

Permalink
Remove llvm-upgrade and update tests.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47784 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
tlattner committed Mar 1, 2008
1 parent e5101bf commit 9bc243b
Show file tree
Hide file tree
Showing 40 changed files with 624 additions and 705 deletions.
27 changes: 14 additions & 13 deletions test/Feature/alignment.ll
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
; RUN: llvm-upgrade < %s | llvm-as | llvm-dis > %t1.ll
; RUN: llvm-as < %s | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll

%X = global int 4, align 16
@X = global i32 4, align 16 ; <i32*> [#uses=0]

int *%test() align 32 {
%X = alloca int, align 4
%Y = alloca int, uint 42, align 16
%Z = alloca int, align 0
ret int *%X
define i32* @test() align 32 {
%X = alloca i32, align 4 ; <i32*> [#uses=1]
%Y = alloca i32, i32 42, align 16 ; <i32*> [#uses=0]
%Z = alloca i32 ; <i32*> [#uses=0]
ret i32* %X
}

int *%test2() {
%X = malloc int, align 4
%Y = malloc int, uint 42, align 16
%Z = malloc int, align 0
%T = malloc int, align 256
ret int *%X
define i32* @test2() {
%X = malloc i32, align 4 ; <i32*> [#uses=1]
%Y = malloc i32, i32 42, align 16 ; <i32*> [#uses=0]
%Z = malloc i32 ; <i32*> [#uses=0]
%T = malloc i32, align 256 ; <i32*> [#uses=0]
ret i32* %X
}

41 changes: 20 additions & 21 deletions test/Feature/basictest.ll
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
; RUN: llvm-upgrade < %s | llvm-as | llvm-dis > %t1.ll
; RUN: llvm-as < %s | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll

implementation

; Test "stripped" format where nothing is symbolic... this is how the bytecode
; format looks anyways (except for negative vs positive offsets)...
;
void "void"(int, int) ; Def %0, %1
begin
add int 0, 0 ; Def 2
sub int 0, 4 ; Def 3
br label %1

add int %0, %1 ; Def 4
sub int %4, %3 ; Def 5
setle int %5, %2 ; Def 0 - bool plane
br bool %0, label %2, label %1
define void @void(i32, i32) {
add i32 0, 0 ; <i32>:3 [#uses=2]
sub i32 0, 4 ; <i32>:4 [#uses=2]
br label %5

; <label>:5 ; preds = %5, %2
add i32 %0, %1 ; <i32>:6 [#uses=2]
sub i32 %6, %4 ; <i32>:7 [#uses=1]
icmp sle i32 %7, %3 ; <i1>:8 [#uses=1]
br i1 %8, label %9, label %5

add int %0, %1 ; Def 6
sub int %4, %3 ; Def 7
setle int %7, %2 ; Def 1 - bool plane
ret void
end
; <label>:9 ; preds = %5
add i32 %0, %1 ; <i32>:10 [#uses=0]
sub i32 %6, %4 ; <i32>:11 [#uses=1]
icmp sle i32 %11, %3 ; <i1>:12 [#uses=0]
ret void
}

; This function always returns zero
int "zarro"()
begin
define i32 @zarro() {
Startup:
ret int 0
end
ret i32 0
}
61 changes: 32 additions & 29 deletions test/Feature/callingconventions.ll
Original file line number Diff line number Diff line change
@@ -1,47 +1,50 @@
; RUN: llvm-upgrade < %s | llvm-as | llvm-dis > %t1.ll
; RUN: llvm-as < %s | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll

fastcc void %foo() {
ret void
define fastcc void @foo() {
ret void
}

coldcc void %bar() {
call fastcc void %foo()
ret void
define coldcc void @bar() {
call fastcc void @foo( )
ret void
}

csretcc void %structret({sbyte}* %P) {
call csretcc void %structret({sbyte}* %P)
ret void
define void @structret({ i8 }* sret %P) {
call void @structret( { i8 }* sret %P )
ret void
}


cc0 void %foo2() {
ret void
define void @foo2() {
ret void
}

coldcc void %bar2() {
call fastcc void %foo()
ret void
define coldcc void @bar2() {
call fastcc void @foo( )
ret void
}

cc42 void %bar3() {
invoke fastcc void %foo() to label %Ok unwind label %U
Ok:
ret void
U:
unwind
}
define cc42 void @bar3() {
invoke fastcc void @foo( )
to label %Ok unwind label %U

Ok: ; preds = %0
ret void

void %bar4() {
call cc42 void %bar()
invoke cc42 void %bar3() to label %Ok unwind label %U
Ok:
ret void
U:
unwind
U: ; preds = %0
unwind
}

define void @bar4() {
call cc42 void @bar( )
invoke cc42 void @bar3( )
to label %Ok unwind label %U

Ok: ; preds = %0
ret void

U: ; preds = %0
unwind
}

50 changes: 24 additions & 26 deletions test/Feature/calltest.ll
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
; RUN: llvm-upgrade < %s | llvm-as | llvm-dis > %t1.ll
; RUN: llvm-as < %s | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll

%FunTy = type int(int)
%FunTy = type i32 (i32)

declare int "test"(int) ; Test forward declaration merging
declare i32 @test(i32) ; Test forward declaration merging

implementation

void "invoke"(%FunTy *%x) {
%foo = call %FunTy* %x(int 123)
%foo2 = tail call %FunTy* %x(int 123)
ret void
define void @invoke(%FunTy* %x) {
%foo = call i32 %x( i32 123 ) ; <i32> [#uses=0]
%foo2 = tail call i32 %x( i32 123 ) ; <i32> [#uses=0]
ret void
}

int "main"(int %argc) ; TODO: , sbyte **argv, sbyte **envp)
begin
%retval = call int (int) *%test(int %argc)
%two = add int %retval, %retval
%retval2 = invoke int %test(int %argc)
to label %Next except label %Error
Next:
%two2 = add int %two, %retval2
call void %invoke (%FunTy* %test)
ret int %two2
Error:
ret int -1
end
define i32 @main(i32 %argc) {
%retval = call i32 @test( i32 %argc ) ; <i32> [#uses=2]
%two = add i32 %retval, %retval ; <i32> [#uses=1]
%retval2 = invoke i32 @test( i32 %argc )
to label %Next unwind label %Error ; <i32> [#uses=1]

Next: ; preds = %0
%two2 = add i32 %two, %retval2 ; <i32> [#uses=1]
call void @invoke( %FunTy* @test )
ret i32 %two2

int "test"(int %i0)
begin
ret int %i0
end
Error: ; preds = %0
ret i32 -1
}

define i32 @test(i32 %i0) {
ret i32 %i0
}
17 changes: 8 additions & 9 deletions test/Feature/casttest.ll
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
; RUN: llvm-upgrade < %s | llvm-as | llvm-dis > %t1.ll
; RUN: llvm-as < %s | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll

short "FunFunc"(long %x, sbyte %z)
begin
bb0: ;;<label>
%cast110 = cast sbyte %z to short ;;<short>:(signed operands)
%cast10 = cast long %x to short ;;<short>
%reg109 = add short %cast110, %cast10 ;;<short>
ret short %reg109 ;;<void>
end
define i16 @FunFunc(i64 %x, i8 %z) {
bb0:
%cast110 = sext i8 %z to i16 ; <i16> [#uses=1]
%cast10 = trunc i64 %x to i16 ; <i16> [#uses=1]
%reg109 = add i16 %cast110, %cast10 ; <i16> [#uses=1]
ret i16 %reg109
}

72 changes: 34 additions & 38 deletions test/Feature/cfgstructures.ll
Original file line number Diff line number Diff line change
@@ -1,57 +1,53 @@
; RUN: llvm-upgrade < %s | llvm-as | llvm-dis > %t1.ll
; RUN: llvm-as < %s | llvm-dis > %t1.ll
; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
; RUN: diff %t1.ll %t2.ll

implementation

;; This is an irreducible flow graph
define void @irreducible(i1 %cond) {
br i1 %cond, label %X, label %Y

X: ; preds = %Y, %0
br label %Y

void "irreducible"(bool %cond)
begin
br bool %cond, label %X, label %Y

X:
br label %Y
Y:
br label %X
end
Y: ; preds = %X, %0
br label %X
}

;; This is a pair of loops that share the same header
define void @sharedheader(i1 %cond) {
br label %A

A: ; preds = %Y, %X, %0
br i1 %cond, label %X, label %Y

X: ; preds = %A
br label %A

void "sharedheader"(bool %cond)
begin
br label %A
A:
br bool %cond, label %X, label %Y
Y: ; preds = %A
br label %A
}

X:
br label %A
Y:
br label %A
end

;; This is a simple nested loop
void "nested"(bool %cond1, bool %cond2, bool %cond3)
begin
br label %Loop1
define void @nested(i1 %cond1, i1 %cond2, i1 %cond3) {
br label %Loop1

Loop1:
br label %Loop2
Loop1: ; preds = %L2Exit, %0
br label %Loop2

Loop2:
br label %Loop3
Loop2: ; preds = %L3Exit, %Loop1
br label %Loop3

Loop3:
br bool %cond3, label %Loop3, label %L3Exit
Loop3: ; preds = %Loop3, %Loop2
br i1 %cond3, label %Loop3, label %L3Exit

L3Exit:
br bool %cond2, label %Loop2, label %L2Exit
L3Exit: ; preds = %Loop3
br i1 %cond2, label %Loop2, label %L2Exit

L2Exit:
br bool %cond1, label %Loop1, label %L1Exit
L2Exit: ; preds = %L3Exit
br i1 %cond1, label %Loop1, label %L1Exit

L1Exit:
ret void
end
L1Exit: ; preds = %L2Exit
ret void
}

Loading

0 comments on commit 9bc243b

Please sign in to comment.