xref: /aosp_15_r20/external/llvm/test/tools/llvm-split/scc-constants.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; All of the functions in this module must end up
2*9880d681SAndroid Build Coastguard Worker; in the same partition.
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; RUN: llvm-split -j=2 -preserve-locals -o %t %s
5*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dis -o - %t0 | FileCheck --check-prefix=CHECK1 %s
6*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dis -o - %t1 | FileCheck --check-prefix=CHECK0 %s
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; CHECK0: declare i32 @foo
9*9880d681SAndroid Build Coastguard Worker; CHECK0: declare i32 @baz
10*9880d681SAndroid Build Coastguard Worker; CHECK0: declare i32 @bar
11*9880d681SAndroid Build Coastguard Worker; CHECK0: declare i32 @bar2
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker; CHECK1: @bla
14*9880d681SAndroid Build Coastguard Worker; CHECK1: @bla2
15*9880d681SAndroid Build Coastguard Worker; CHECK1: define internal i32 @foo
16*9880d681SAndroid Build Coastguard Worker; CHECK1: define internal i32 @baz
17*9880d681SAndroid Build Coastguard Worker; CHECK1: define i32 @bar
18*9880d681SAndroid Build Coastguard Worker; CHECK1: define i32 @bar2
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Worker%struct.anon = type { i64, i64 }
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker@bla = internal global %struct.anon { i64 1, i64 2 }, align 8
23*9880d681SAndroid Build Coastguard Worker@bla2 = internal global %struct.anon { i64 1, i64 2 }, align 8
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Workerdefine internal i32 @foo() {
26*9880d681SAndroid Build Coastguard Workerentry:
27*9880d681SAndroid Build Coastguard Worker  store i64 5, i64* getelementptr inbounds (%struct.anon, %struct.anon* @bla, i32 0, i32 0), align 8
28*9880d681SAndroid Build Coastguard Worker  store i32 -1, i32* bitcast (i64* getelementptr inbounds (%struct.anon, %struct.anon* @bla2, i32 0, i32 1) to i32*), align 8
29*9880d681SAndroid Build Coastguard Worker  ret i32 0
30*9880d681SAndroid Build Coastguard Worker}
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Workerdefine internal i32 @baz() {
33*9880d681SAndroid Build Coastguard Workerentry:
34*9880d681SAndroid Build Coastguard Worker  store i64 5, i64* getelementptr inbounds (%struct.anon, %struct.anon* @bla, i32 0, i32 0), align 8
35*9880d681SAndroid Build Coastguard Worker  store i32 -1, i32* bitcast (i64* getelementptr inbounds (%struct.anon, %struct.anon* @bla2, i32 0, i32 1) to i32*), align 8
36*9880d681SAndroid Build Coastguard Worker  ret i32 0
37*9880d681SAndroid Build Coastguard Worker}
38*9880d681SAndroid Build Coastguard Worker
39*9880d681SAndroid Build Coastguard Workerdefine i32 @bar() {
40*9880d681SAndroid Build Coastguard Worker  %call = call i32 @foo()
41*9880d681SAndroid Build Coastguard Worker  ret i32 0
42*9880d681SAndroid Build Coastguard Worker}
43*9880d681SAndroid Build Coastguard Worker
44*9880d681SAndroid Build Coastguard Workerdefine i32 @bar2() {
45*9880d681SAndroid Build Coastguard Worker  %call = call i32 @baz()
46*9880d681SAndroid Build Coastguard Worker  ret i32 0
47*9880d681SAndroid Build Coastguard Worker}
48*9880d681SAndroid Build Coastguard Worker
49