Skip to content

Commit 18843ff

Browse files
committed
Perform renaming and simplification of the test
1 parent 33b8865 commit 18843ff

File tree

2 files changed

+107
-120
lines changed

2 files changed

+107
-120
lines changed

llvm/test/tools/llvm-split/SYCL/device-code-split/auto-module-split-1.ll

Lines changed: 0 additions & 120 deletions
This file was deleted.
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
; Test checks that kernels are being split by attached TU metadata and
2+
; used functions are being moved with kernels that use them.
3+
4+
; RUN: llvm-split -sycl-split=source -S < %s -o %t
5+
; RUN: FileCheck %s -input-file=%t_0.ll --check-prefixes CHECK-TU0,CHECK
6+
; RUN: FileCheck %s -input-file=%t_1.ll --check-prefixes CHECK-TU1,CHECK
7+
; RUN: FileCheck %s -input-file=%t_0.sym --check-prefixes CHECK-TU0-TXT
8+
; RUN: FileCheck %s -input-file=%t_1.sym --check-prefixes CHECK-TU1-TXT
9+
10+
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
11+
target triple = "spir64-unknown-linux"
12+
13+
; CHECK-TU1-NOT: @GV
14+
; CHECK-TU0: @GV = internal addrspace(1) constant [1 x i32] [i32 42], align 4
15+
@GV = internal addrspace(1) constant [1 x i32] [i32 42], align 4
16+
17+
; CHECK-TU1: define dso_local spir_kernel void @TU1_kernel0
18+
; CHECK-TU1-TXT: TU1_kernel0
19+
; CHECK-TU0-NOT: define dso_local spir_kernel void @TU1_kernel0
20+
; CHECK-TU0-TXT-NOT: TU1_kernel0
21+
22+
; CHECK-TU1: call spir_func void @func1_TU1()
23+
24+
define dso_local spir_kernel void @TU1_kernel0() #0 {
25+
entry:
26+
call spir_func void @func1_TU1()
27+
ret void
28+
}
29+
30+
; CHECK-TU1: define {{.*}} spir_func void @func1_TU1()
31+
; CHECK-TU0-NOT: define {{.*}} spir_func void @func1_TU1()
32+
33+
; CHECK-TU1: call spir_func void @func2_TU1()
34+
35+
define dso_local spir_func void @func1_TU1() {
36+
entry:
37+
call spir_func void @func2_TU1()
38+
ret void
39+
}
40+
41+
; CHECK-TU1: define {{.*}} spir_func void @func2_TU1()
42+
; CHECK-TU0-NOT: define {{.*}} spir_func void @func2_TU1()
43+
44+
define linkonce_odr dso_local spir_func void @func2_TU1() {
45+
entry:
46+
ret void
47+
}
48+
49+
; CHECK-TU1: define dso_local spir_kernel void @TU1_kernel1()
50+
; CHECK-TU1-TXT: TU1_kernel1
51+
; CHECK-TU0-NOT: define dso_local spir_kernel void @TU1_kernel1()
52+
; CHECK-TU0-TXT-NOT: TU1_kernel1
53+
54+
; CHECK-TU1: call spir_func void @func3_TU1()
55+
56+
define dso_local spir_kernel void @TU1_kernel1() #0 {
57+
entry:
58+
call spir_func void @func3_TU1()
59+
ret void
60+
}
61+
62+
; CHECK-TU1: define {{.*}} spir_func void @func3_TU1()
63+
; CHECK-TU0-NOT: define {{.*}} spir_func void @func3_TU1()
64+
65+
define dso_local spir_func void @func3_TU1() {
66+
entry:
67+
ret void
68+
}
69+
70+
; CHECK-TU1-NOT: define dso_local spir_kernel void @TU0_kernel()
71+
; CHECK-TU1-TXT-NOT: TU0_kernel
72+
; CHECK-TU0: define dso_local spir_kernel void @TU0_kernel()
73+
; CHECK-TU0-TXT: TU0_kernel
74+
75+
; CHECK-TU0: call spir_func void @func_TU0()
76+
77+
define dso_local spir_kernel void @TU0_kernel() #1 {
78+
entry:
79+
call spir_func void @func_TU0()
80+
ret void
81+
}
82+
83+
; CHECK-TU1-NOT: define {{.*}} spir_func void @func_TU0()
84+
; CHECK-TU0: define {{.*}} spir_func void @func_TU0()
85+
86+
define dso_local spir_func void @func_TU0() {
87+
entry:
88+
; CHECK-TU0: %0 = load i32, ptr addrspace(4) addrspacecast (ptr addrspace(1) @GV to ptr addrspace(4)), align 4
89+
%0 = load i32, ptr addrspace(4) getelementptr inbounds ([1 x i32], ptr addrspace(4) addrspacecast (ptr addrspace(1) @GV to ptr addrspace(4)), i64 0, i64 0), align 4
90+
ret void
91+
}
92+
93+
attributes #0 = { "sycl-module-id"="TU1.cpp" }
94+
attributes #1 = { "sycl-module-id"="TU2.cpp" }
95+
96+
; Metadata is saved in both modules.
97+
; CHECK: !opencl.spir.version = !{!0, !0}
98+
; CHECK: !spirv.Source = !{!1, !1}
99+
100+
!opencl.spir.version = !{!0, !0}
101+
!spirv.Source = !{!1, !1}
102+
103+
; CHECK: !0 = !{i32 1, i32 2}
104+
; CHECK: !1 = !{i32 4, i32 100000}
105+
106+
!0 = !{i32 1, i32 2}
107+
!1 = !{i32 4, i32 100000}

0 commit comments

Comments
 (0)