Add missing run line
[oota-llvm.git] / test / CodeGen / Generic / GC / alloc_loop.ll
1 ; RUN: llvm-as < %s | llc
2
3 implementation
4
5 declare sbyte* %llvm_gc_allocate(uint)
6 declare void %llvm_gc_initialize(uint)
7
8 declare void %llvm.gcroot(sbyte**, sbyte*)
9 declare void %llvm.gcwrite(sbyte*, sbyte*, sbyte**)
10
11 int %main() {
12 entry:
13         %A = alloca sbyte*
14         %B = alloca sbyte**
15
16         call void %llvm_gc_initialize(uint 1048576)  ; Start with 1MB heap
17
18         ;; void *A;
19         call void %llvm.gcroot(sbyte** %A, sbyte* null)
20
21         ;; A = gcalloc(10);
22         %Aptr = call sbyte* %llvm_gc_allocate(uint 10)
23         store sbyte* %Aptr, sbyte** %A
24
25         ;; void **B;
26         %tmp.1 = cast sbyte*** %B to sbyte **
27         call void %llvm.gcroot(sbyte** %tmp.1, sbyte* null)
28
29         ;; B = gcalloc(4);
30         %B = call sbyte* %llvm_gc_allocate(uint 8)
31         %tmp.2 = cast sbyte* %B to sbyte**
32         store sbyte** %tmp.2, sbyte*** %B
33
34         ;; *B = A;
35         %B.1 = load sbyte*** %B
36         %A.1 = load sbyte** %A
37         call void %llvm.gcwrite(sbyte* %A.1, sbyte* %B, sbyte** %B.1)
38         
39         br label %AllocLoop
40
41 AllocLoop:
42         %i = phi uint [ 0, %entry ], [ %indvar.next, %AllocLoop ]
43         ;; Allocated mem: allocated memory is immediately dead.
44         call sbyte* %llvm_gc_allocate(uint 100)
45         
46         %indvar.next = add uint %i, 1
47         %exitcond = seteq uint %indvar.next, 10000000
48         br bool %exitcond, label %Exit, label %AllocLoop
49
50 Exit:
51         ret int 0
52 }
53
54 declare void %__main()