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