1; We should never separate alias from aliasee.
2; RUN: llvm-split -j=3 -preserve-locals -o %t %s
3; RUN: llvm-dis -o - %t0 | FileCheck --check-prefix=CHECK0 %s
4; RUN: llvm-dis -o - %t1 | FileCheck --check-prefix=CHECK1 %s
5; RUN: llvm-dis -o - %t2 | FileCheck --check-prefix=CHECK2 %s
6
7; Checks are not critical here - verifier will assert if we fail.
8; CHECK0: @g1 = global i32 99
9; CHECK0: @c1Alias = external global i8
10; CHECK0: @g1Alias = internal alias i8, bitcast (i32* @g1 to i8*)
11
12; CHECK1: @g1 = external global i32
13; CHECK1: @c1Alias = internal alias i8, inttoptr (i64 42 to i8*)
14
15; Third file is actually empty.
16; CHECK2: @g1 = external global i32
17; CHECK2: @g1Alias = external global i8
18; CHECK2: @c1Alias = external global i8
19
20@g1 = global i32 99
21
22@g1Alias = internal alias i8, bitcast (i32* @g1 to i8*)
23@c1Alias = internal alias i8, inttoptr (i64 42 to i8*)
24@funExternalAlias = alias i8 (), i8 ()* @funExternal
25
26define i8 @funExternal() {
27entry:
28  %x = load i8, i8* @g1Alias
29  ret i8 %x
30}
31
32define i8 @funExternal2() {
33entry:
34  %x = load i8, i8* @c1Alias
35  %y = call i8 @funExternalAlias()
36  %z = add i8 %x, %y
37  ret i8 %z
38}
39