[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / llvm / test / Transforms / OpenMP / spmdization_guarding_two_reaching_kernels.ll
blob00c8642a6034a5dd480079ad7604a229a48b8810
1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature --check-globals
2 ; RUN: opt -S -passes=openmp-opt < %s | FileCheck %s --check-prefixes=CHECK
3 ; RUN: opt -S -passes=openmp-opt -openmp-opt-disable-spmdization < %s | FileCheck %s --check-prefixes=CHECK-DISABLE-SPMDIZATION
5 ; int G;
7 ; void leaf() {
8 ;   G = 42;
9 ; }
11 ; void spmd_helper() {
12 ;   leaf();
13 ; #pragma omp parallel
14 ;   unknown();
15 ; }
16 ; void spmd() {
17 ; #pragma omp target
18 ;   spmd_helper();
19 ; }
21 ; void generic_helper() {
22 ;   leaf();
23 ; }
24 ; void generic() {
25 ; #pragma omp target
26 ;   generic_helper();
27 ; }
29 target datalayout = "e-i64:64-i128:128-v16:16-v32:32-n16:32:64"
30 target triple = "nvptx64"
32 %struct.ident_t = type { i32, i32, i32, i32, ptr }
33 %struct.ConfigurationEnvironmentTy = type { i8, i8, i8, i32, i32, i32, i32 }
34 %struct.KernelEnvironmentTy = type { %struct.ConfigurationEnvironmentTy, ptr, ptr }
36 @0 = private unnamed_addr constant [23 x i8] c";unknown;unknown;0;0;;\00", align 1
37 @1 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 0, ptr @0 }, align 8
38 @2 = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 2, i32 0, ptr @0 }, align 8
39 @G = external global i32, align 4
40 @__omp_offloading_2b_10393b5_spmd_l12_kernel_environment = local_unnamed_addr constant %struct.KernelEnvironmentTy { %struct.ConfigurationEnvironmentTy { i8 0, i8 0, i8 1, i32 0, i32 0, i32 0, i32 0 }, ptr @1, ptr null }
41 @__omp_offloading_2b_10393b5_generic_l20_kernel_environment = local_unnamed_addr constant %struct.KernelEnvironmentTy { %struct.ConfigurationEnvironmentTy { i8 0, i8 0, i8 1, i32 0, i32 0, i32 0, i32 0 }, ptr @1, ptr null }
44 ; CHECK: @[[GLOB0:[0-9]+]] = private unnamed_addr constant [23 x i8] c"
45 ; CHECK: @[[GLOB1:[0-9]+]] = private unnamed_addr constant [[STRUCT_IDENT_T:%.*]] { i32 0, i32 2, i32 0, i32 0, ptr @[[GLOB0]] }, align 8
46 ; CHECK: @[[GLOB2:[0-9]+]] = private unnamed_addr constant [[STRUCT_IDENT_T:%.*]] { i32 0, i32 2, i32 2, i32 0, ptr @[[GLOB0]] }, align 8
47 ; CHECK: @[[G:[a-zA-Z0-9_$"\\.-]+]] = external global i32, align 4
48 ; CHECK: @[[__OMP_OFFLOADING_2B_10393B5_SPMD_L12_KERNEL_ENVIRONMENT:[a-zA-Z0-9_$"\\.-]+]] = local_unnamed_addr constant [[STRUCT_KERNELENVIRONMENTTY:%.*]] { [[STRUCT_CONFIGURATIONENVIRONMENTTY:%.*]] { i8 0, i8 1, i8 3, i32 0, i32 0, i32 0, i32 0 }, ptr @[[GLOB1]], ptr null }
49 ; CHECK: @[[__OMP_OFFLOADING_2B_10393B5_GENERIC_L20_KERNEL_ENVIRONMENT:[a-zA-Z0-9_$"\\.-]+]] = local_unnamed_addr constant [[STRUCT_KERNELENVIRONMENTTY:%.*]] { [[STRUCT_CONFIGURATIONENVIRONMENTTY:%.*]] { i8 0, i8 0, i8 3, i32 0, i32 0, i32 0, i32 0 }, ptr @[[GLOB1]], ptr null }
50 ; CHECK: @[[GLOB3:[0-9]+]] = private unnamed_addr constant [[STRUCT_IDENT_T:%.*]] { i32 0, i32 2, i32 0, i32 22, ptr @[[GLOB0]] }, align 8
52 ; CHECK-DISABLE-SPMDIZATION: @[[GLOB0:[0-9]+]] = private unnamed_addr constant [23 x i8] c"
53 ; CHECK-DISABLE-SPMDIZATION: @[[GLOB1:[0-9]+]] = private unnamed_addr constant [[STRUCT_IDENT_T:%.*]] { i32 0, i32 2, i32 0, i32 0, ptr @[[GLOB0]] }, align 8
54 ; CHECK-DISABLE-SPMDIZATION: @[[GLOB2:[0-9]+]] = private unnamed_addr constant [[STRUCT_IDENT_T:%.*]] { i32 0, i32 2, i32 2, i32 0, ptr @[[GLOB0]] }, align 8
55 ; CHECK-DISABLE-SPMDIZATION: @[[G:[a-zA-Z0-9_$"\\.-]+]] = external global i32, align 4
56 ; CHECK-DISABLE-SPMDIZATION: @[[__OMP_OFFLOADING_2B_10393B5_SPMD_L12_KERNEL_ENVIRONMENT:[a-zA-Z0-9_$"\\.-]+]] = local_unnamed_addr constant [[STRUCT_KERNELENVIRONMENTTY:%.*]] { [[STRUCT_CONFIGURATIONENVIRONMENTTY:%.*]] { i8 0, i8 1, i8 1, i32 0, i32 0, i32 0, i32 0 }, ptr @[[GLOB1]], ptr null }
57 ; CHECK-DISABLE-SPMDIZATION: @[[__OMP_OFFLOADING_2B_10393B5_GENERIC_L20_KERNEL_ENVIRONMENT:[a-zA-Z0-9_$"\\.-]+]] = local_unnamed_addr constant [[STRUCT_KERNELENVIRONMENTTY:%.*]] { [[STRUCT_CONFIGURATIONENVIRONMENTTY:%.*]] { i8 0, i8 0, i8 1, i32 0, i32 0, i32 0, i32 0 }, ptr @[[GLOB1]], ptr null }
59 define weak void @__omp_offloading_2b_10393b5_spmd_l12(ptr %dyn) "kernel" #0 {
60 ; CHECK-LABEL: define {{[^@]+}}@__omp_offloading_2b_10393b5_spmd_l12
61 ; CHECK-SAME: (ptr [[DYN:%.*]]) #[[ATTR0:[0-9]+]] {
62 ; CHECK-NEXT:  entry:
63 ; CHECK-NEXT:    [[TMP0:%.*]] = call i32 @__kmpc_target_init(ptr @__omp_offloading_2b_10393b5_spmd_l12_kernel_environment, ptr [[DYN]])
64 ; CHECK-NEXT:    [[EXEC_USER_CODE:%.*]] = icmp eq i32 [[TMP0]], -1
65 ; CHECK-NEXT:    br i1 [[EXEC_USER_CODE]], label [[USER_CODE_ENTRY:%.*]], label [[WORKER_EXIT:%.*]]
66 ; CHECK:       user_code.entry:
67 ; CHECK-NEXT:    call void @spmd_helper() #[[ATTR6:[0-9]+]]
68 ; CHECK-NEXT:    call void @__kmpc_target_deinit()
69 ; CHECK-NEXT:    ret void
70 ; CHECK:       worker.exit:
71 ; CHECK-NEXT:    ret void
73 ; CHECK-DISABLE-SPMDIZATION-LABEL: define {{[^@]+}}@__omp_offloading_2b_10393b5_spmd_l12
74 ; CHECK-DISABLE-SPMDIZATION-SAME: (ptr [[DYN:%.*]]) #[[ATTR0:[0-9]+]] {
75 ; CHECK-DISABLE-SPMDIZATION-NEXT:  entry:
76 ; CHECK-DISABLE-SPMDIZATION-NEXT:    [[TMP0:%.*]] = call i32 @__kmpc_target_init(ptr @__omp_offloading_2b_10393b5_spmd_l12_kernel_environment, ptr [[DYN]])
77 ; CHECK-DISABLE-SPMDIZATION-NEXT:    [[EXEC_USER_CODE:%.*]] = icmp eq i32 [[TMP0]], -1
78 ; CHECK-DISABLE-SPMDIZATION-NEXT:    br i1 [[EXEC_USER_CODE]], label [[USER_CODE_ENTRY:%.*]], label [[WORKER_EXIT:%.*]]
79 ; CHECK-DISABLE-SPMDIZATION:       user_code.entry:
80 ; CHECK-DISABLE-SPMDIZATION-NEXT:    call void @spmd_helper() #[[ATTR6:[0-9]+]]
81 ; CHECK-DISABLE-SPMDIZATION-NEXT:    call void @__kmpc_target_deinit()
82 ; CHECK-DISABLE-SPMDIZATION-NEXT:    ret void
83 ; CHECK-DISABLE-SPMDIZATION:       worker.exit:
84 ; CHECK-DISABLE-SPMDIZATION-NEXT:    ret void
86 entry:
87   %0 = call i32 @__kmpc_target_init(ptr @__omp_offloading_2b_10393b5_spmd_l12_kernel_environment, ptr %dyn)
88   %exec_user_code = icmp eq i32 %0, -1
89   br i1 %exec_user_code, label %user_code.entry, label %worker.exit
91 user_code.entry:                                  ; preds = %entry
92   call void @spmd_helper() #5
93   call void @__kmpc_target_deinit()
94   ret void
96 worker.exit:                                      ; preds = %entry
97   ret void
100 ; Make it a weak definition so we will apply custom state machine rewriting but can't use the body in the reasoning.
101 define weak i32 @__kmpc_target_init(ptr, ptr) {
102 ; CHECK-LABEL: define {{[^@]+}}@__kmpc_target_init
103 ; CHECK-SAME: (ptr [[TMP0:%.*]], ptr [[TMP1:%.*]]) {
104 ; CHECK-NEXT:    ret i32 0
106 ; CHECK-DISABLE-SPMDIZATION-LABEL: define {{[^@]+}}@__kmpc_target_init
107 ; CHECK-DISABLE-SPMDIZATION-SAME: (ptr [[TMP0:%.*]], ptr [[TMP1:%.*]]) {
108 ; CHECK-DISABLE-SPMDIZATION-NEXT:    ret i32 0
110   ret i32 0
113 declare void @__kmpc_target_deinit()
115 ; Function Attrs: convergent noinline norecurse nounwind
116 define weak void @__omp_offloading_2b_10393b5_generic_l20(ptr %dyn) #0 {
117 ; CHECK-LABEL: define {{[^@]+}}@__omp_offloading_2b_10393b5_generic_l20
118 ; CHECK-SAME: (ptr [[DYN:%.*]]) #[[ATTR0]] {
119 ; CHECK-NEXT:  entry:
120 ; CHECK-NEXT:    [[TMP0:%.*]] = call i32 @__kmpc_target_init(ptr @__omp_offloading_2b_10393b5_generic_l20_kernel_environment, ptr [[DYN]])
121 ; CHECK-NEXT:    [[THREAD_ID_IN_BLOCK:%.*]] = call i32 @__kmpc_get_hardware_thread_id_in_block()
122 ; CHECK-NEXT:    [[THREAD_IS_MAIN:%.*]] = icmp ne i32 [[THREAD_ID_IN_BLOCK]], 0
123 ; CHECK-NEXT:    br i1 [[THREAD_IS_MAIN]], label [[EXIT_THREADS:%.*]], label [[MAIN_THREAD_USER_CODE:%.*]]
124 ; CHECK:       exit.threads:
125 ; CHECK-NEXT:    ret void
126 ; CHECK:       main.thread.user_code:
127 ; CHECK-NEXT:    [[EXEC_USER_CODE:%.*]] = icmp eq i32 [[TMP0]], -1
128 ; CHECK-NEXT:    br i1 [[EXEC_USER_CODE]], label [[USER_CODE_ENTRY:%.*]], label [[WORKER_EXIT:%.*]]
129 ; CHECK:       user_code.entry:
130 ; CHECK-NEXT:    call void @generic_helper() #[[ATTR7:[0-9]+]]
131 ; CHECK-NEXT:    call void @__kmpc_target_deinit()
132 ; CHECK-NEXT:    ret void
133 ; CHECK:       worker.exit:
134 ; CHECK-NEXT:    ret void
136 ; CHECK-DISABLE-SPMDIZATION-LABEL: define {{[^@]+}}@__omp_offloading_2b_10393b5_generic_l20
137 ; CHECK-DISABLE-SPMDIZATION-SAME: (ptr [[DYN:%.*]]) #[[ATTR0]] {
138 ; CHECK-DISABLE-SPMDIZATION-NEXT:  entry:
139 ; CHECK-DISABLE-SPMDIZATION-NEXT:    [[TMP0:%.*]] = call i32 @__kmpc_target_init(ptr @__omp_offloading_2b_10393b5_generic_l20_kernel_environment, ptr [[DYN]])
140 ; CHECK-DISABLE-SPMDIZATION-NEXT:    [[EXEC_USER_CODE:%.*]] = icmp eq i32 [[TMP0]], -1
141 ; CHECK-DISABLE-SPMDIZATION-NEXT:    br i1 [[EXEC_USER_CODE]], label [[USER_CODE_ENTRY:%.*]], label [[WORKER_EXIT:%.*]]
142 ; CHECK-DISABLE-SPMDIZATION:       user_code.entry:
143 ; CHECK-DISABLE-SPMDIZATION-NEXT:    call void @generic_helper() #[[ATTR7:[0-9]+]]
144 ; CHECK-DISABLE-SPMDIZATION-NEXT:    call void @__kmpc_target_deinit()
145 ; CHECK-DISABLE-SPMDIZATION-NEXT:    ret void
146 ; CHECK-DISABLE-SPMDIZATION:       worker.exit:
147 ; CHECK-DISABLE-SPMDIZATION-NEXT:    ret void
149 entry:
150   %0 = call i32 @__kmpc_target_init(ptr @__omp_offloading_2b_10393b5_generic_l20_kernel_environment, ptr %dyn)
151   %exec_user_code = icmp eq i32 %0, -1
152   br i1 %exec_user_code, label %user_code.entry, label %worker.exit
154 user_code.entry:                                  ; preds = %entry
155   call void @generic_helper() #5
156   call void @__kmpc_target_deinit()
157   ret void
159 worker.exit:                                      ; preds = %entry
160   ret void
163 ; Function Attrs: convergent noinline nounwind
164 define internal void @spmd_helper() #1 {
165 ; CHECK-LABEL: define {{[^@]+}}@spmd_helper
166 ; CHECK-SAME: () #[[ATTR1:[0-9]+]] {
167 ; CHECK-NEXT:  entry:
168 ; CHECK-NEXT:    [[CAPTURED_VARS_ADDRS:%.*]] = alloca [0 x ptr], align 8
169 ; CHECK-NEXT:    call void @leaf() #[[ATTR7]]
170 ; CHECK-NEXT:    [[TMP0:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB2]]) #[[ATTR3:[0-9]+]]
171 ; CHECK-NEXT:    call void @__kmpc_parallel_51(ptr @[[GLOB2]], i32 [[TMP0]], i32 1, i32 -1, i32 -1, ptr @__omp_outlined__, ptr @__omp_outlined___wrapper, ptr [[CAPTURED_VARS_ADDRS]], i64 0)
172 ; CHECK-NEXT:    ret void
174 ; CHECK-DISABLE-SPMDIZATION-LABEL: define {{[^@]+}}@spmd_helper
175 ; CHECK-DISABLE-SPMDIZATION-SAME: () #[[ATTR1:[0-9]+]] {
176 ; CHECK-DISABLE-SPMDIZATION-NEXT:  entry:
177 ; CHECK-DISABLE-SPMDIZATION-NEXT:    [[CAPTURED_VARS_ADDRS:%.*]] = alloca [0 x ptr], align 8
178 ; CHECK-DISABLE-SPMDIZATION-NEXT:    call void @leaf() #[[ATTR7]]
179 ; CHECK-DISABLE-SPMDIZATION-NEXT:    [[TMP0:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB2]]) #[[ATTR3:[0-9]+]]
180 ; CHECK-DISABLE-SPMDIZATION-NEXT:    call void @__kmpc_parallel_51(ptr @[[GLOB2]], i32 [[TMP0]], i32 1, i32 -1, i32 -1, ptr @__omp_outlined__, ptr @__omp_outlined___wrapper, ptr [[CAPTURED_VARS_ADDRS]], i64 0)
181 ; CHECK-DISABLE-SPMDIZATION-NEXT:    ret void
183 entry:
184   %captured_vars_addrs = alloca [0 x ptr], align 8
185   call void @leaf() #5
186   %0 = call i32 @__kmpc_global_thread_num(ptr @2)
187   call void @__kmpc_parallel_51(ptr @2, i32 %0, i32 1, i32 -1, i32 -1, ptr @__omp_outlined__, ptr @__omp_outlined___wrapper, ptr %captured_vars_addrs, i64 0)
188   ret void
191 ; Function Attrs: convergent noinline norecurse nounwind
192 define internal void @__omp_outlined__(ptr noalias %.global_tid., ptr noalias %.bound_tid.) {
193 ; CHECK-LABEL: define {{[^@]+}}@__omp_outlined__
194 ; CHECK-SAME: (ptr noalias [[DOTGLOBAL_TID_:%.*]], ptr noalias [[DOTBOUND_TID_:%.*]]) {
195 ; CHECK-NEXT:  entry:
196 ; CHECK-NEXT:    [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
197 ; CHECK-NEXT:    [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
198 ; CHECK-NEXT:    call void @unknown() #[[ATTR8:[0-9]+]]
199 ; CHECK-NEXT:    ret void
201 ; CHECK-DISABLE-SPMDIZATION-LABEL: define {{[^@]+}}@__omp_outlined__
202 ; CHECK-DISABLE-SPMDIZATION-SAME: (ptr noalias [[DOTGLOBAL_TID_:%.*]], ptr noalias [[DOTBOUND_TID_:%.*]]) {
203 ; CHECK-DISABLE-SPMDIZATION-NEXT:  entry:
204 ; CHECK-DISABLE-SPMDIZATION-NEXT:    [[DOTGLOBAL_TID__ADDR:%.*]] = alloca ptr, align 8
205 ; CHECK-DISABLE-SPMDIZATION-NEXT:    [[DOTBOUND_TID__ADDR:%.*]] = alloca ptr, align 8
206 ; CHECK-DISABLE-SPMDIZATION-NEXT:    call void @unknown() #[[ATTR8:[0-9]+]]
207 ; CHECK-DISABLE-SPMDIZATION-NEXT:    ret void
209 entry:
210   %.global_tid..addr = alloca ptr, align 8
211   %.bound_tid..addr = alloca ptr, align 8
212   store ptr %.global_tid., ptr %.global_tid..addr, align 8
213   store ptr %.bound_tid., ptr %.bound_tid..addr, align 8
214   call void @unknown() #5
215   ret void
218 ; Function Attrs: convergent noinline norecurse nounwind
219 define internal void @__omp_outlined___wrapper(i16 zeroext %0, i32 %1) #2 {
220 ; CHECK-LABEL: define {{[^@]+}}@__omp_outlined___wrapper
221 ; CHECK-SAME: (i16 zeroext [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR2:[0-9]+]] {
222 ; CHECK-NEXT:  entry:
223 ; CHECK-NEXT:    [[DOTADDR:%.*]] = alloca i16, align 2
224 ; CHECK-NEXT:    [[DOTADDR1:%.*]] = alloca i32, align 4
225 ; CHECK-NEXT:    [[DOTZERO_ADDR:%.*]] = alloca i32, align 4
226 ; CHECK-NEXT:    [[GLOBAL_ARGS:%.*]] = alloca ptr, align 8
227 ; CHECK-NEXT:    call void @__kmpc_get_shared_variables(ptr [[GLOBAL_ARGS]])
228 ; CHECK-NEXT:    call void @__omp_outlined__(ptr [[DOTADDR1]], ptr [[DOTZERO_ADDR]]) #[[ATTR3]]
229 ; CHECK-NEXT:    ret void
231 ; CHECK-DISABLE-SPMDIZATION-LABEL: define {{[^@]+}}@__omp_outlined___wrapper
232 ; CHECK-DISABLE-SPMDIZATION-SAME: (i16 zeroext [[TMP0:%.*]], i32 [[TMP1:%.*]]) #[[ATTR2:[0-9]+]] {
233 ; CHECK-DISABLE-SPMDIZATION-NEXT:  entry:
234 ; CHECK-DISABLE-SPMDIZATION-NEXT:    [[DOTADDR:%.*]] = alloca i16, align 2
235 ; CHECK-DISABLE-SPMDIZATION-NEXT:    [[DOTADDR1:%.*]] = alloca i32, align 4
236 ; CHECK-DISABLE-SPMDIZATION-NEXT:    [[DOTZERO_ADDR:%.*]] = alloca i32, align 4
237 ; CHECK-DISABLE-SPMDIZATION-NEXT:    [[GLOBAL_ARGS:%.*]] = alloca ptr, align 8
238 ; CHECK-DISABLE-SPMDIZATION-NEXT:    call void @__kmpc_get_shared_variables(ptr [[GLOBAL_ARGS]])
239 ; CHECK-DISABLE-SPMDIZATION-NEXT:    call void @__omp_outlined__(ptr [[DOTADDR1]], ptr [[DOTZERO_ADDR]]) #[[ATTR3]]
240 ; CHECK-DISABLE-SPMDIZATION-NEXT:    ret void
242 entry:
243   %.addr = alloca i16, align 2
244   %.addr1 = alloca i32, align 4
245   %.zero.addr = alloca i32, align 4
246   %global_args = alloca ptr, align 8
247   store i16 %0, ptr %.addr, align 2
248   store i32 %1, ptr %.addr1, align 4
249   store i32 0, ptr %.zero.addr, align 4
250   call void @__kmpc_get_shared_variables(ptr %global_args)
251   call void @__omp_outlined__(ptr %.addr1, ptr %.zero.addr) #3
252   ret void
255 declare void @__kmpc_get_shared_variables(ptr)
257 ; Function Attrs: nounwind
258 declare i32 @__kmpc_global_thread_num(ptr) #3
260 ; Function Attrs: alwaysinline
261 declare void @__kmpc_parallel_51(ptr, i32, i32, i32, i32, ptr, ptr, ptr, i64) #4
263 ; Function Attrs: convergent noinline nounwind
264 define internal void @leaf() #1 {
265 ; CHECK-LABEL: define {{[^@]+}}@leaf
266 ; CHECK-SAME: () #[[ATTR5:[0-9]+]] {
267 ; CHECK-NEXT:  entry:
268 ; CHECK-NEXT:    br label [[REGION_CHECK_TID:%.*]]
269 ; CHECK:       region.check.tid:
270 ; CHECK-NEXT:    [[TMP0:%.*]] = call i32 @__kmpc_get_hardware_thread_id_in_block()
271 ; CHECK-NEXT:    [[TMP1:%.*]] = icmp eq i32 [[TMP0]], 0
272 ; CHECK-NEXT:    br i1 [[TMP1]], label [[REGION_GUARDED:%.*]], label [[REGION_BARRIER:%.*]]
273 ; CHECK:       region.guarded:
274 ; CHECK-NEXT:    store i32 42, ptr @G, align 4
275 ; CHECK-NEXT:    br label [[REGION_GUARDED_END:%.*]]
276 ; CHECK:       region.guarded.end:
277 ; CHECK-NEXT:    br label [[REGION_BARRIER]]
278 ; CHECK:       region.barrier:
279 ; CHECK-NEXT:    call void @__kmpc_barrier_simple_spmd(ptr @[[GLOB3]], i32 [[TMP0]])
280 ; CHECK-NEXT:    br label [[REGION_EXIT:%.*]]
281 ; CHECK:       region.exit:
282 ; CHECK-NEXT:    ret void
284 ; CHECK-DISABLE-SPMDIZATION-LABEL: define {{[^@]+}}@leaf
285 ; CHECK-DISABLE-SPMDIZATION-SAME: () #[[ATTR5:[0-9]+]] {
286 ; CHECK-DISABLE-SPMDIZATION-NEXT:  entry:
287 ; CHECK-DISABLE-SPMDIZATION-NEXT:    store i32 42, ptr @G, align 4
288 ; CHECK-DISABLE-SPMDIZATION-NEXT:    ret void
290 entry:
291   store i32 42, ptr @G, align 4
292   ret void
295 ; Function Attrs: convergent noinline nounwind
296 define internal void @generic_helper() #1 {
297 ; CHECK-LABEL: define {{[^@]+}}@generic_helper
298 ; CHECK-SAME: () #[[ATTR5]] {
299 ; CHECK-NEXT:  entry:
300 ; CHECK-NEXT:    call void @leaf() #[[ATTR7]]
301 ; CHECK-NEXT:    ret void
303 ; CHECK-DISABLE-SPMDIZATION-LABEL: define {{[^@]+}}@generic_helper
304 ; CHECK-DISABLE-SPMDIZATION-SAME: () #[[ATTR5]] {
305 ; CHECK-DISABLE-SPMDIZATION-NEXT:  entry:
306 ; CHECK-DISABLE-SPMDIZATION-NEXT:    call void @leaf() #[[ATTR7]]
307 ; CHECK-DISABLE-SPMDIZATION-NEXT:    ret void
309 entry:
310   call void @leaf() #5
311   ret void
314 declare void @unknown()
316 attributes #0 = { convergent noinline norecurse nounwind "kernel" "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="sm_53" "target-features"="+ptx32,+sm_53" }
317 attributes #1 = { convergent noinline nounwind  "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="sm_53" "target-features"="+ptx32,+sm_53" }
318 attributes #2 = { convergent noinline norecurse nounwind "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="sm_53" "target-features"="+ptx32,+sm_53" }
319 attributes #3 = { nounwind }
320 attributes #4 = { alwaysinline }
321 attributes #5 = { convergent }
323 !omp_offload.info = !{!0, !1}
324 !nvvm.annotations = !{!2, !3}
325 !llvm.module.flags = !{!4, !5, !6, !7, !8}
326 !llvm.ident = !{!9}
328 !0 = !{i32 0, i32 43, i32 17011637, !"spmd", i32 12, i32 0}
329 !1 = !{i32 0, i32 43, i32 17011637, !"generic", i32 20, i32 1}
330 !2 = !{ptr @__omp_offloading_2b_10393b5_spmd_l12, !"kernel", i32 1}
331 !3 = !{ptr @__omp_offloading_2b_10393b5_generic_l20, !"kernel", i32 1}
332 !4 = !{i32 1, !"wchar_size", i32 4}
333 !5 = !{i32 7, !"openmp", i32 50}
334 !6 = !{i32 7, !"openmp-device", i32 50}
335 !7 = !{i32 8, !"PIC Level", i32 2}
336 !8 = !{i32 7, !"frame-pointer", i32 2}
337 !9 = !{!"clang version 14.0.0"}
339 ; CHECK: attributes #[[ATTR0]] = { convergent noinline norecurse nounwind "frame-pointer"="all" "kernel" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="sm_53" "target-features"="+ptx32,+sm_53" }
340 ; CHECK: attributes #[[ATTR1]] = { noinline nounwind "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="sm_53" "target-features"="+ptx32,+sm_53" }
341 ; CHECK: attributes #[[ATTR2]] = { noinline norecurse nounwind "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="sm_53" "target-features"="+ptx32,+sm_53" }
342 ; CHECK: attributes #[[ATTR3]] = { nounwind }
343 ; CHECK: attributes #[[ATTR4:[0-9]+]] = { alwaysinline }
344 ; CHECK: attributes #[[ATTR5]] = { noinline nosync nounwind memory(write) "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="sm_53" "target-features"="+ptx32,+sm_53" }
345 ; CHECK: attributes #[[ATTR6]] = { convergent nounwind }
346 ; CHECK: attributes #[[ATTR7]] = { convergent nosync nounwind memory(write) }
347 ; CHECK: attributes #[[ATTR8]] = { convergent }
349 ; CHECK-DISABLE-SPMDIZATION: attributes #[[ATTR0]] = { convergent noinline norecurse nounwind "frame-pointer"="all" "kernel" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="sm_53" "target-features"="+ptx32,+sm_53" }
350 ; CHECK-DISABLE-SPMDIZATION: attributes #[[ATTR1]] = { noinline nounwind "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="sm_53" "target-features"="+ptx32,+sm_53" }
351 ; CHECK-DISABLE-SPMDIZATION: attributes #[[ATTR2]] = { noinline norecurse nounwind "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="sm_53" "target-features"="+ptx32,+sm_53" }
352 ; CHECK-DISABLE-SPMDIZATION: attributes #[[ATTR3]] = { nounwind }
353 ; CHECK-DISABLE-SPMDIZATION: attributes #[[ATTR4:[0-9]+]] = { alwaysinline }
354 ; CHECK-DISABLE-SPMDIZATION: attributes #[[ATTR5]] = { noinline nosync nounwind memory(write) "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="sm_53" "target-features"="+ptx32,+sm_53" }
355 ; CHECK-DISABLE-SPMDIZATION: attributes #[[ATTR6]] = { convergent nounwind }
356 ; CHECK-DISABLE-SPMDIZATION: attributes #[[ATTR7]] = { convergent nosync nounwind memory(write) }
357 ; CHECK-DISABLE-SPMDIZATION: attributes #[[ATTR8]] = { convergent }
359 ; CHECK: [[META0:![0-9]+]] = !{i32 0, i32 43, i32 17011637, !"spmd", i32 12, i32 0}
360 ; CHECK: [[META1:![0-9]+]] = !{i32 0, i32 43, i32 17011637, !"generic", i32 20, i32 1}
361 ; CHECK: [[META2:![0-9]+]] = !{ptr @__omp_offloading_2b_10393b5_spmd_l12, !"kernel", i32 1}
362 ; CHECK: [[META3:![0-9]+]] = !{ptr @__omp_offloading_2b_10393b5_generic_l20, !"kernel", i32 1}
363 ; CHECK: [[META4:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
364 ; CHECK: [[META5:![0-9]+]] = !{i32 7, !"openmp", i32 50}
365 ; CHECK: [[META6:![0-9]+]] = !{i32 7, !"openmp-device", i32 50}
366 ; CHECK: [[META7:![0-9]+]] = !{i32 8, !"PIC Level", i32 2}
367 ; CHECK: [[META8:![0-9]+]] = !{i32 7, !"frame-pointer", i32 2}
368 ; CHECK: [[META9:![0-9]+]] = !{!"clang version 14.0.0"}
370 ; CHECK-DISABLE-SPMDIZATION: [[META0:![0-9]+]] = !{i32 0, i32 43, i32 17011637, !"spmd", i32 12, i32 0}
371 ; CHECK-DISABLE-SPMDIZATION: [[META1:![0-9]+]] = !{i32 0, i32 43, i32 17011637, !"generic", i32 20, i32 1}
372 ; CHECK-DISABLE-SPMDIZATION: [[META2:![0-9]+]] = !{ptr @__omp_offloading_2b_10393b5_spmd_l12, !"kernel", i32 1}
373 ; CHECK-DISABLE-SPMDIZATION: [[META3:![0-9]+]] = !{ptr @__omp_offloading_2b_10393b5_generic_l20, !"kernel", i32 1}
374 ; CHECK-DISABLE-SPMDIZATION: [[META4:![0-9]+]] = !{i32 1, !"wchar_size", i32 4}
375 ; CHECK-DISABLE-SPMDIZATION: [[META5:![0-9]+]] = !{i32 7, !"openmp", i32 50}
376 ; CHECK-DISABLE-SPMDIZATION: [[META6:![0-9]+]] = !{i32 7, !"openmp-device", i32 50}
377 ; CHECK-DISABLE-SPMDIZATION: [[META7:![0-9]+]] = !{i32 8, !"PIC Level", i32 2}
378 ; CHECK-DISABLE-SPMDIZATION: [[META8:![0-9]+]] = !{i32 7, !"frame-pointer", i32 2}
379 ; CHECK-DISABLE-SPMDIZATION: [[META9:![0-9]+]] = !{!"clang version 14.0.0"}