2006-12-29 20:01:32 +00:00
|
|
|
; RUN: llvm-upgrade < %s | llvm-as > %t.bc
|
2007-04-15 18:11:57 +00:00
|
|
|
; RUN: llvm-upgrade < %p/testlink2.ll | llvm-as > %t2.bc
|
2003-09-15 20:04:28 +00:00
|
|
|
; RUN: llvm-link %t.bc %t2.bc
|
2001-10-13 07:15:38 +00:00
|
|
|
|
2003-04-21 21:06:25 +00:00
|
|
|
%MyVar = external global int
|
2001-10-13 07:15:38 +00:00
|
|
|
%MyIntList = global { \2 *, int } { { \2, int }* null, int 17 }
|
2003-04-21 21:06:25 +00:00
|
|
|
external global int ; int*:0
|
2001-10-13 07:15:38 +00:00
|
|
|
|
2006-12-15 17:34:37 +00:00
|
|
|
%Inte = global int 1
|
|
|
|
|
2004-12-03 19:48:10 +00:00
|
|
|
%AConst = linkonce constant int 123
|
2001-10-13 07:15:38 +00:00
|
|
|
|
2001-11-26 19:17:06 +00:00
|
|
|
%Intern1 = internal constant int 42
|
|
|
|
%Intern2 = internal constant int 792
|
|
|
|
|
2001-10-15 03:11:58 +00:00
|
|
|
; Initialized to point to external %MyVar
|
2003-04-23 18:38:13 +00:00
|
|
|
%MyVarPtr = linkonce global { int * } { int * %MyVar }
|
2001-10-15 03:11:58 +00:00
|
|
|
|
2001-10-13 07:15:38 +00:00
|
|
|
declare int "foo"(int %blah) ;; Declared in testlink2.ll
|
|
|
|
|
|
|
|
declare void "print"(int %Value)
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
void "main"()
|
|
|
|
begin
|
|
|
|
%v1 = load int* %MyVar
|
|
|
|
call void %print(int %v1) ;; Should start out 4
|
|
|
|
|
2006-11-23 15:14:52 +00:00
|
|
|
%idx = getelementptr { \2 *, int }* %MyIntList, long 0, uint 1
|
2002-08-21 23:52:57 +00:00
|
|
|
%v2 = load int* %idx
|
2001-10-13 07:15:38 +00:00
|
|
|
call void %print(int %v2) ;; Should start out 17
|
|
|
|
|
|
|
|
call int %foo(int 5) ;; Modify global variablesx
|
|
|
|
|
|
|
|
%v3 = load int* %MyVar
|
|
|
|
call void %print(int %v3) ;; Should now be 5
|
|
|
|
|
2002-08-21 23:52:57 +00:00
|
|
|
%v4 = load int* %idx
|
2001-10-13 07:15:38 +00:00
|
|
|
call void %print(int %v4) ;; Should start out 12
|
|
|
|
|
|
|
|
ret void
|
|
|
|
end
|
|
|
|
|
2001-11-26 19:17:06 +00:00
|
|
|
internal void "testintern"() begin ret void end
|
|
|
|
internal void "Testintern"() begin ret void end
|
|
|
|
void "testIntern"() begin ret void end
|
|
|
|
|