xref: /llvm-project/llvm/test/tools/llvm-split/AMDGPU/recursive-search-2.ll (revision 9347b66cfcd9acf84dbbd500b6344041c587f6a9)
1; RUN: llvm-split -o %t_s3_ %s -j 3 -mtriple amdgcn-amd-amdhsa -amdgpu-module-splitting-max-depth=2
2; RUN: llvm-dis -o - %t_s3_0 | FileCheck --check-prefix=SPLIT3-CHECK0 --implicit-check-not=define %s
3; RUN: llvm-dis -o - %t_s3_1 | FileCheck --check-prefix=SPLIT3-CHECK1 --implicit-check-not=define %s
4; RUN: llvm-dis -o - %t_s3_2 | FileCheck --check-prefix=SPLIT3-CHECK2 --implicit-check-not=define %s
5
6; RUN: llvm-split -o %t_s5_ %s -j 5 -mtriple amdgcn-amd-amdhsa -amdgpu-module-splitting-max-depth=2
7; RUN: llvm-dis -o - %t_s5_0 | FileCheck --check-prefix=SPLIT5-CHECK0 --implicit-check-not=define %s
8; RUN: llvm-dis -o - %t_s5_1 | FileCheck --check-prefix=SPLIT5-CHECK1 --implicit-check-not=define %s
9; RUN: llvm-dis -o - %t_s5_2 | FileCheck --check-prefix=SPLIT5-CHECK2 --implicit-check-not=define %s
10; RUN: llvm-dis -o - %t_s5_3 | FileCheck --check-prefix=SPLIT5-CHECK3 --implicit-check-not=define %s
11; RUN: llvm-dis -o - %t_s5_4 | FileCheck --check-prefix=SPLIT5-CHECK4 --implicit-check-not=define %s
12
13; Test the specifics of the search algorithm.
14; This test will change depending on new heuristics we add or remove.
15
16; --------------------------------------------
17
18; SPLIT3-CHECK0: define amdgpu_kernel void @B()
19; SPLIT3-CHECK0: define internal void @HelperB()
20; SPLIT3-CHECK0: define internal void @HelperC()
21; SPLIT3-CHECK0: define amdgpu_kernel void @BC()
22
23; SPLIT3-CHECK1: define amdgpu_kernel void @A()
24; SPLIT3-CHECK1: define internal void @HelperA()
25; SPLIT3-CHECK1: define amdgpu_kernel void @C()
26; SPLIT3-CHECK1: define internal void @HelperC()
27
28; SPLIT3-CHECK2: define internal void @HelperA()
29; SPLIT3-CHECK2: define internal void @HelperB()
30; SPLIT3-CHECK2: define internal void @HelperC()
31; SPLIT3-CHECK2: define amdgpu_kernel void @AB()
32; SPLIT3-CHECK2: define amdgpu_kernel void @ABC()
33
34; --------------------------------------------
35
36; SPLIT5-CHECK0: define amdgpu_kernel void @A()
37; SPLIT5-CHECK0: define internal void @HelperA()
38
39; SPLIT5-CHECK1: define amdgpu_kernel void @B()
40; SPLIT5-CHECK1: define internal void @HelperB()
41
42; SPLIT5-CHECK2: define internal void @HelperB()
43; SPLIT5-CHECK2: define internal void @HelperC()
44; SPLIT5-CHECK2: define amdgpu_kernel void @BC()
45
46; SPLIT5-CHECK3: define amdgpu_kernel void @C()
47; SPLIT5-CHECK3: define internal void @HelperC()
48
49; SPLIT5-CHECK4: define internal void @HelperA()
50; SPLIT5-CHECK4: define internal void @HelperB()
51; SPLIT5-CHECK4: define internal void @HelperC()
52; SPLIT5-CHECK4: define amdgpu_kernel void @AB()
53; SPLIT5-CHECK4: define amdgpu_kernel void @ABC()
54
55define amdgpu_kernel void @A() {
56  store volatile i64 42, ptr null
57  store volatile i64 42, ptr null
58  store volatile i64 42, ptr null
59  store volatile i64 42, ptr null
60  store volatile i64 42, ptr null
61  call void @HelperA()
62  ret void
63}
64
65define internal void @HelperA() {
66  store volatile i32 42, ptr null
67  store volatile i32 42, ptr null
68  ret void
69}
70
71define amdgpu_kernel void @B() {
72  store volatile i64 42, ptr null
73  store volatile i64 42, ptr null
74  store volatile i64 42, ptr null
75  store volatile i64 42, ptr null
76  call void @HelperB()
77  ret void
78}
79
80define internal void @HelperB() {
81  store volatile i32 42, ptr null
82  store volatile i32 42, ptr null
83  store volatile i32 42, ptr null
84  ret void
85}
86
87define amdgpu_kernel void @C() {
88  store volatile i64 42, ptr null
89  store volatile i64 42, ptr null
90  store volatile i64 42, ptr null
91  store volatile i64 42, ptr null
92  store volatile i64 42, ptr null
93  store volatile i64 42, ptr null
94  store volatile i64 42, ptr null
95  store volatile i64 42, ptr null
96  call void @HelperC()
97  ret void
98}
99
100define internal void @HelperC() {
101  store volatile i32 42, ptr null
102  ret void
103}
104
105define amdgpu_kernel void @AB() {
106  store volatile i32 42, ptr null
107  call void @HelperA()
108  call void @HelperB()
109  ret void
110}
111
112define amdgpu_kernel void @BC() {
113  store volatile i32 42, ptr null
114  store volatile i32 42, ptr null
115  call void @HelperB()
116  call void @HelperC()
117  ret void
118}
119
120define amdgpu_kernel void @ABC() {
121  call void @HelperA()
122  call void @HelperB()
123  call void @HelperC()
124  ret void
125}
126