blob: 91d983374d3a4ac3ae91d9d799df397f51e62f4a [file] [log] [blame]
Misha Brukmanb6cb66f2003-09-15 20:04:28 +00001; RUN: llvm-as < %s > %t.bc
2; RUN: llvm-as < `dirname %s`/testlink2.ll > %t2.bc
3; RUN: llvm-link %t.bc %t2.bc
Chris Lattner285c68d2001-10-13 07:15:38 +00004
Chris Lattner8869c2c2003-04-21 21:06:25 +00005%MyVar = external global int
Chris Lattner285c68d2001-10-13 07:15:38 +00006%MyIntList = global { \2 *, int } { { \2, int }* null, int 17 }
Chris Lattner8869c2c2003-04-21 21:06:25 +00007 external global int ; int*:0
Chris Lattner285c68d2001-10-13 07:15:38 +00008
Andrew Lenharthc8782ad2006-12-15 17:34:37 +00009%Inte = global int 1
10
Chris Lattnerf0db7a92004-12-03 19:48:10 +000011%AConst = linkonce constant int 123
Chris Lattner285c68d2001-10-13 07:15:38 +000012
Chris Lattnerb4b07c72001-11-26 19:17:06 +000013%Intern1 = internal constant int 42
14%Intern2 = internal constant int 792
15
Chris Lattner230e5ef2001-10-15 03:11:58 +000016; Initialized to point to external %MyVar
Chris Lattnere709a212003-04-23 18:38:13 +000017%MyVarPtr = linkonce global { int * } { int * %MyVar }
Chris Lattner230e5ef2001-10-15 03:11:58 +000018
Chris Lattner285c68d2001-10-13 07:15:38 +000019declare int "foo"(int %blah) ;; Declared in testlink2.ll
20
21declare void "print"(int %Value)
22
23implementation
24
25void "main"()
26begin
27 %v1 = load int* %MyVar
28 call void %print(int %v1) ;; Should start out 4
29
Reid Spencere5d4efa2006-11-23 15:14:52 +000030 %idx = getelementptr { \2 *, int }* %MyIntList, long 0, uint 1
Chris Lattnere7e59182002-08-21 23:52:57 +000031 %v2 = load int* %idx
Chris Lattner285c68d2001-10-13 07:15:38 +000032 call void %print(int %v2) ;; Should start out 17
33
34 call int %foo(int 5) ;; Modify global variablesx
35
36 %v3 = load int* %MyVar
37 call void %print(int %v3) ;; Should now be 5
38
Chris Lattnere7e59182002-08-21 23:52:57 +000039 %v4 = load int* %idx
Chris Lattner285c68d2001-10-13 07:15:38 +000040 call void %print(int %v4) ;; Should start out 12
41
42 ret void
43end
44
Chris Lattnerb4b07c72001-11-26 19:17:06 +000045internal void "testintern"() begin ret void end
46internal void "Testintern"() begin ret void end
47 void "testIntern"() begin ret void end
48