c3593852d71936efce55104c61bee618aab50cbd
[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* @bar
9 @foo2 = alias i32* @bar
10 @foo3 = alias i32* @foo2
11 @foo4 = unnamed_addr alias i32* @foo2
12
13 %FunTy = type i32()
14
15 define i32 @foo_f() {
16   ret i32 0
17 }
18 @bar_f = alias weak_odr %FunTy* @foo_f
19 @bar_ff = alias i32()* @bar_f
20
21 @bar_i = alias internal i32* @bar
22
23 @A = alias bitcast (i32* @bar to i64*)
24
25 define i32 @test() {
26 entry:
27    %tmp = load i32* @foo1
28    %tmp1 = load i32* @foo2
29    %tmp0 = load i32* @bar_i
30    %tmp2 = call i32 @foo_f()
31    %tmp3 = add i32 %tmp, %tmp2
32    %tmp4 = call %FunTy* @bar_f()
33    %tmp5 = add i32 %tmp3, %tmp4
34    %tmp6 = add i32 %tmp1, %tmp5
35    %tmp7 = add i32 %tmp6, %tmp0
36    ret i32 %tmp7
37 }