[opaque pointer type] Add textual IR support for explicit type parameter for global...
[oota-llvm.git] / test / Feature / aliases.ll
1 ; RUN: llvm-as < %s | llvm-dis > %t1.ll
2 ; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
3 ; RUN: diff %t1.ll %t2.ll
4
5 @llvm.used = appending global [1 x i8*] [i8* bitcast (i32* @foo1 to i8*)], section "llvm.metadata"
6
7 @bar = global i32 0
8 @foo1 = alias i32, i32* @bar
9 @foo2 = alias i32, i32* @bar
10 @foo3 = alias i32, i32* @foo2
11 @foo4 = unnamed_addr alias i32, i32* @foo2
12
13 ; Make sure the verifier does not complain about references to a global
14 ; declaration from an initializer.
15 @decl = external global i32
16 @ptr = global i32* @decl
17 @ptr_a = alias i32*, i32** @ptr
18
19 %FunTy = type i32()
20
21 define i32 @foo_f() {
22   ret i32 0
23 }
24 @bar_f = weak_odr alias %FunTy, %FunTy* @foo_f
25 @bar_ff = alias i32(), i32()* @bar_f
26
27 @bar_i = internal alias i32, i32* @bar
28
29 @A = alias i64, bitcast (i32* @bar to i64*)
30
31 define i32 @test() {
32 entry:
33    %tmp = load i32, i32* @foo1
34    %tmp1 = load i32, i32* @foo2
35    %tmp0 = load i32, i32* @bar_i
36    %tmp2 = call i32 @foo_f()
37    %tmp3 = add i32 %tmp, %tmp2
38    %tmp4 = call %FunTy @bar_f()
39    %tmp5 = add i32 %tmp3, %tmp4
40    %tmp6 = add i32 %tmp1, %tmp5
41    %tmp7 = add i32 %tmp6, %tmp0
42    ret i32 %tmp7
43 }