[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / metadirective_implementation_codegen.cpp
blobb9f43d1a1e87cd04090115fd1e9f83b885a47fd1
1 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-linux -emit-llvm %s -fexceptions -fcxx-exceptions -o - -fsanitize-address-use-after-scope | FileCheck %s
2 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple aarch64-unknown-linux -emit-llvm %s -fexceptions -fcxx-exceptions -o - -fsanitize-address-use-after-scope | FileCheck %s
3 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple ppc64le-unknown-linux -emit-llvm %s -fexceptions -fcxx-exceptions -o - -fsanitize-address-use-after-scope | FileCheck %s
4 // expected-no-diagnostics
6 #ifndef HEADER
7 #define HEADER
9 void bar();
11 void foo() {
12 #pragma omp metadirective when(implementation = {vendor(score(0) \
13 : llvm)}, \
14 device = {kind(cpu)} \
15 : parallel) default(target teams)
16 bar();
17 #pragma omp metadirective when(device = {kind(gpu)} \
18 : target teams) when(implementation = {vendor(llvm)} \
19 : parallel) default()
20 bar();
21 #pragma omp metadirective default(target) when(implementation = {vendor(score(5) \
22 : llvm)}, \
23 device = {kind(cpu, host)} \
24 : parallel)
25 bar();
26 #pragma omp metadirective when(implementation = {extension(match_all)} \
27 : parallel) default(parallel for)
28 for (int i = 0; i < 100; i++)
30 #pragma omp metadirective when(implementation = {extension(match_any)} \
31 : parallel) default(parallel for)
32 for (int i = 0; i < 100; i++)
34 #pragma omp metadirective when(implementation = {extension(match_none)} \
35 : parallel) default(parallel for)
36 for (int i = 0; i < 100; i++)
40 // CHECK-LABEL: void @_Z3foov()
41 // CHECK: @__kmpc_fork_call(ptr {{.+}}, i32 0, ptr [[OUTLINED_2:@.+]])
42 // CHECK: @__kmpc_fork_call(ptr {{.+}}, i32 0, ptr [[OUTLINED_3:@.+]])
43 // CHECK: @__kmpc_fork_call(ptr {{.+}}, i32 0, ptr [[OUTLINED_4:@.+]])
44 // CHECK: @__kmpc_fork_call(ptr {{.+}}, i32 0, ptr [[OUTLINED_5:@.+]])
45 // CHECK: @__kmpc_fork_call(ptr {{.+}}, i32 0, ptr [[OUTLINED_6:@.+]])
46 // CHECK: @__kmpc_fork_call(ptr {{.+}}, i32 0, ptr [[OUTLINED_7:@.+]])
47 // CHECK: ret void
49 // CHECK: define internal void [[OUTLINED_2]](
50 // CHECK: @_Z3barv
51 // CHECK: ret void
53 // CHECK: define internal void [[OUTLINED_3]](
54 // CHECK: @_Z3barv
55 // CHECK: ret void
57 // CHECK: define internal void [[OUTLINED_4]](
58 // CHECK: @_Z3barv
59 // CHECK: ret void
61 // CHECK: define internal void [[OUTLINED_5]](
62 // NO-CHECK: call void @__kmpc_for_static_init
63 // NO-CHECK: call void @__kmpc_for_static_fini
64 // CHECK: ret void
66 // CHECK: define internal void [[OUTLINED_6]](
67 // CHECK: call void @__kmpc_for_static_init
68 // CHECK: call void @__kmpc_for_static_fini
69 // CHECK: ret void
71 // CHECK: define internal void [[OUTLINED_7]](
72 // NO-CHECK: call void @__kmpc_for_static_init
73 // NO-CHECK: call void @__kmpc_for_static_fini
74 // CHECK: ret void
76 #endif