llvm.org GIT mirror llvm / 3820069
Upgrading this test to 2.0 .ll syntax. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44738 91177308-0d34-0410-b5e6-96231b3b80d8 Gordon Henriksen 12 years ago
1 changed file(s) with 27 addition(s) and 28 deletion(s). Raw diff Collapse all Expand all
None ; RUN: llvm-upgrade < %s | llvm-as | llc
0 ; RUN: llvm-as < %s | llc
11
2 implementation
32
4 declare sbyte* %llvm_gc_allocate(uint)
5 declare void %llvm_gc_initialize(uint)
3 declare i8* @llvm_gc_allocate(i32)
4 declare void @llvm_gc_initialize(i32)
65
7 declare void %llvm.gcroot(sbyte**, sbyte*)
8 declare void %llvm.gcwrite(sbyte*, sbyte*, sbyte**)
6 declare void @llvm.gcroot(i8**, i8*)
7 declare void @llvm.gcwrite(i8*, i8*, i8**)
98
10 int %main() {
9 define i32 @main() {
1110 entry:
12 %A = alloca sbyte*
13 %B = alloca sbyte**
11 %A = alloca i8*
12 %B = alloca i8**
1413
15 call void %llvm_gc_initialize(uint 1048576) ; Start with 1MB heap
14 call void @llvm_gc_initialize(i32 1048576) ; Start with 1MB heap
1615
1716 ;; void *A;
18 call void %llvm.gcroot(sbyte** %A, sbyte* null)
17 call void @llvm.gcroot(i8** %A, i8* null)
1918
2019 ;; A = gcalloc(10);
21 %Aptr = call sbyte* %llvm_gc_allocate(uint 10)
22 store sbyte* %Aptr, sbyte** %A
20 %Aptr = call i8* @llvm_gc_allocate(i32 10)
21 store i8* %Aptr, i8** %A
2322
2423 ;; void **B;
25 %tmp.1 = cast sbyte*** %B to sbyte **
26 call void %llvm.gcroot(sbyte** %tmp.1, sbyte* null)
24 %tmp.1 = bitcast i8*** %B to i8**
25 call void @llvm.gcroot(i8** %tmp.1, i8* null)
2726
2827 ;; B = gcalloc(4);
29 %B = call sbyte* %llvm_gc_allocate(uint 8)
30 %tmp.2 = cast sbyte* %B to sbyte**
31 store sbyte** %tmp.2, sbyte*** %B
28 %B.upgrd.1 = call i8* @llvm_gc_allocate(i32 8)
29 %tmp.2 = bitcast i8* %B.upgrd.1 to i8**
30 store i8** %tmp.2, i8*** %B
3231
3332 ;; *B = A;
34 %B.1 = load sbyte*** %B
35 %A.1 = load sbyte** %A
36 call void %llvm.gcwrite(sbyte* %A.1, sbyte* %B, sbyte** %B.1)
33 %B.1 = load i8*** %B
34 %A.1 = load i8** %A
35 call void @llvm.gcwrite(i8* %A.1, i8* %B.upgrd.1, i8** %B.1)
3736
3837 br label %AllocLoop
3938
4039 AllocLoop:
41 %i = phi uint [ 0, %entry ], [ %indvar.next, %AllocLoop ]
40 %i = phi i32 [ 0, %entry ], [ %indvar.next, %AllocLoop ]
4241 ;; Allocated mem: allocated memory is immediately dead.
43 call sbyte* %llvm_gc_allocate(uint 100)
42 call i8* @llvm_gc_allocate(i32 100)
4443
45 %indvar.next = add uint %i, 1
46 %exitcond = seteq uint %indvar.next, 10000000
47 br bool %exitcond, label %Exit, label %AllocLoop
44 %indvar.next = add i32 %i, 1
45 %exitcond = icmp eq i32 %indvar.next, 10000000
46 br i1 %exitcond, label %Exit, label %AllocLoop
4847
4948 Exit:
50 ret int 0
49 ret i32 0
5150 }
5251
53 declare void %__main()
52 declare void @__main()