xref: /llvm-project/llvm/test/tools/llvm-split/AMDGPU/recursive-search-2.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=2
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=2
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 @B()
19*9347b66cSPierre van Houtryve; SPLIT3-CHECK0: define internal void @HelperB()
20*9347b66cSPierre van Houtryve; SPLIT3-CHECK0: define internal void @HelperC()
21*9347b66cSPierre van Houtryve; SPLIT3-CHECK0: define amdgpu_kernel void @BC()
22*9347b66cSPierre van Houtryve
23*9347b66cSPierre van Houtryve; SPLIT3-CHECK1: define amdgpu_kernel void @A()
24*9347b66cSPierre van Houtryve; SPLIT3-CHECK1: define internal void @HelperA()
25*9347b66cSPierre van Houtryve; SPLIT3-CHECK1: define amdgpu_kernel void @C()
26*9347b66cSPierre van Houtryve; SPLIT3-CHECK1: define internal void @HelperC()
27*9347b66cSPierre van Houtryve
28*9347b66cSPierre van Houtryve; SPLIT3-CHECK2: define internal void @HelperA()
29*9347b66cSPierre van Houtryve; SPLIT3-CHECK2: define internal void @HelperB()
30*9347b66cSPierre van Houtryve; SPLIT3-CHECK2: define internal void @HelperC()
31*9347b66cSPierre van Houtryve; SPLIT3-CHECK2: define amdgpu_kernel void @AB()
32*9347b66cSPierre van Houtryve; SPLIT3-CHECK2: define amdgpu_kernel void @ABC()
33*9347b66cSPierre van Houtryve
34*9347b66cSPierre van Houtryve; --------------------------------------------
35*9347b66cSPierre van Houtryve
36*9347b66cSPierre van Houtryve; SPLIT5-CHECK0: define amdgpu_kernel void @A()
37*9347b66cSPierre van Houtryve; SPLIT5-CHECK0: define internal void @HelperA()
38*9347b66cSPierre van Houtryve
39*9347b66cSPierre van Houtryve; SPLIT5-CHECK1: define amdgpu_kernel void @B()
40*9347b66cSPierre van Houtryve; SPLIT5-CHECK1: define internal void @HelperB()
41*9347b66cSPierre van Houtryve
42*9347b66cSPierre van Houtryve; SPLIT5-CHECK2: define internal void @HelperB()
43*9347b66cSPierre van Houtryve; SPLIT5-CHECK2: define internal void @HelperC()
44*9347b66cSPierre van Houtryve; SPLIT5-CHECK2: define amdgpu_kernel void @BC()
45*9347b66cSPierre van Houtryve
46*9347b66cSPierre van Houtryve; SPLIT5-CHECK3: define amdgpu_kernel void @C()
47*9347b66cSPierre van Houtryve; SPLIT5-CHECK3: define internal void @HelperC()
48*9347b66cSPierre van Houtryve
49*9347b66cSPierre van Houtryve; SPLIT5-CHECK4: define internal void @HelperA()
50*9347b66cSPierre van Houtryve; SPLIT5-CHECK4: define internal void @HelperB()
51*9347b66cSPierre van Houtryve; SPLIT5-CHECK4: define internal void @HelperC()
52*9347b66cSPierre van Houtryve; SPLIT5-CHECK4: define amdgpu_kernel void @AB()
53*9347b66cSPierre van Houtryve; SPLIT5-CHECK4: define amdgpu_kernel void @ABC()
54*9347b66cSPierre van Houtryve
55*9347b66cSPierre van Houtryvedefine amdgpu_kernel void @A() {
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  store volatile i64 42, ptr null
61*9347b66cSPierre van Houtryve  call void @HelperA()
62*9347b66cSPierre van Houtryve  ret void
63*9347b66cSPierre van Houtryve}
64*9347b66cSPierre van Houtryve
65*9347b66cSPierre van Houtryvedefine internal void @HelperA() {
66*9347b66cSPierre van Houtryve  store volatile i32 42, ptr null
67*9347b66cSPierre van Houtryve  store volatile i32 42, ptr null
68*9347b66cSPierre van Houtryve  ret void
69*9347b66cSPierre van Houtryve}
70*9347b66cSPierre van Houtryve
71*9347b66cSPierre van Houtryvedefine amdgpu_kernel void @B() {
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  store volatile i64 42, ptr null
76*9347b66cSPierre van Houtryve  call void @HelperB()
77*9347b66cSPierre van Houtryve  ret void
78*9347b66cSPierre van Houtryve}
79*9347b66cSPierre van Houtryve
80*9347b66cSPierre van Houtryvedefine internal void @HelperB() {
81*9347b66cSPierre van Houtryve  store volatile i32 42, ptr null
82*9347b66cSPierre van Houtryve  store volatile i32 42, ptr null
83*9347b66cSPierre van Houtryve  store volatile i32 42, ptr null
84*9347b66cSPierre van Houtryve  ret void
85*9347b66cSPierre van Houtryve}
86*9347b66cSPierre van Houtryve
87*9347b66cSPierre van Houtryvedefine amdgpu_kernel void @C() {
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  store volatile i64 42, ptr null
96*9347b66cSPierre van Houtryve  call void @HelperC()
97*9347b66cSPierre van Houtryve  ret void
98*9347b66cSPierre van Houtryve}
99*9347b66cSPierre van Houtryve
100*9347b66cSPierre van Houtryvedefine internal void @HelperC() {
101*9347b66cSPierre van Houtryve  store volatile i32 42, ptr null
102*9347b66cSPierre van Houtryve  ret void
103*9347b66cSPierre van Houtryve}
104*9347b66cSPierre van Houtryve
105*9347b66cSPierre van Houtryvedefine amdgpu_kernel void @AB() {
106*9347b66cSPierre van Houtryve  store volatile i32 42, ptr null
107*9347b66cSPierre van Houtryve  call void @HelperA()
108*9347b66cSPierre van Houtryve  call void @HelperB()
109*9347b66cSPierre van Houtryve  ret void
110*9347b66cSPierre van Houtryve}
111*9347b66cSPierre van Houtryve
112*9347b66cSPierre van Houtryvedefine amdgpu_kernel void @BC() {
113*9347b66cSPierre van Houtryve  store volatile i32 42, ptr null
114*9347b66cSPierre van Houtryve  store volatile i32 42, ptr null
115*9347b66cSPierre van Houtryve  call void @HelperB()
116*9347b66cSPierre van Houtryve  call void @HelperC()
117*9347b66cSPierre van Houtryve  ret void
118*9347b66cSPierre van Houtryve}
119*9347b66cSPierre van Houtryve
120*9347b66cSPierre van Houtryvedefine amdgpu_kernel void @ABC() {
121*9347b66cSPierre van Houtryve  call void @HelperA()
122*9347b66cSPierre van Houtryve  call void @HelperB()
123*9347b66cSPierre van Houtryve  call void @HelperC()
124*9347b66cSPierre van Houtryve  ret void
125*9347b66cSPierre van Houtryve}
126