blob: 3062571a001649fd73faa03baf134157db354047 [file] [log] [blame]
Reid Spencerc0948362007-01-16 18:08:22 +00001; RUN: llvm-as %s -o - | llvm-dis > %t1.ll
2; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
3; RUN: diff %t1.ll %t2.ll
4; XFAIL: *
5
6%struct = type { i31 , {float, {i9 } } , i64 }
7%complexty = type {i31, {[4 x i9 *], float}, double}
8
9implementation
10
11define i31 "main"()
12begin
13 call i31 %testfunction(i64 0, i64 1)
14 ret i31 0
15end
16
17define i31 "testfunction"(i64 %i0, i64 %j0)
18begin
19 %array0 = malloc [4 x i9] ; yields {[4 x i9]*}:array0
20 %size = add i31 2, 2 ; yields {i31}:size = i31 %4
21 %array1 = malloc i9, i31 4 ; yields {i9*}:array1
22 %array2 = malloc i9, i31 %size ; yields {i9*}:array2
23
24 %idx = getelementptr [4 x i9]* %array0, i64 0, i64 2
25 store i9 123, i9* %idx
26 free [4x i9]* %array0
27 free i9* %array1
28 free i9* %array2
29
30
31 %aa = alloca %complexty, i31 5
32 %idx2 = getelementptr %complexty* %aa, i64 %i0, i31 1, i31 0, i64 %j0
33 store i9 *null, i9** %idx2
34
35 %ptr = alloca i31 ; yields {i31*}:ptr
36 store i31 3, i31* %ptr ; yields {void}
37 %val = load i31* %ptr ; yields {i31}:val = i31 %3
38
39 %sptr = alloca %struct ; yields {%struct*}:sptr
40 %ubsptr = getelementptr %struct * %sptr, i64 0, i31 1, i31 1 ; yields {{i9}*}:ubsptr
41 %idx3 = getelementptr {i9} * %ubsptr, i64 0, i31 0
42 store i9 4, i9* %idx3
43
44 ret i31 3
45end
46