xref: /llvm-project/clang/test/OpenMP/multiple_regions_per_line.cpp (revision 63ca93c7d1d1ee91281ff7ccdbd7014151319324)
1c954cfebSMike Rice //RUN: %clang_cc1 -verify -x c++ -triple x86_64 -fopenmp -fopenmp-version=51 \
2c954cfebSMike Rice //RUN:  -fopenmp-targets=x86_64 -I%S/Inputs -emit-llvm -o - %s | FileCheck %s
3c954cfebSMike Rice 
4c954cfebSMike Rice //RUN: %clang_cc1 -x c++ -triple x86_64 -fopenmp -fopenmp-version=51 \
5c954cfebSMike Rice //RUN:  -fopenmp-targets=x86_64 -I%S/Inputs -emit-llvm-bc -o %t-host.bc %s
6c954cfebSMike Rice 
7c954cfebSMike Rice //RUN: %clang_cc1 -x c++ -triple x86_64 -fopenmp -fopenmp-version=51 \
8*63ca93c7SSergio Afonso //RUN:  -fopenmp-targets=x86_64 -I%S/Inputs -fopenmp-is-target-device \
9c954cfebSMike Rice //RUN:  -fopenmp-host-ir-file-path %t-host.bc -emit-llvm -o - %s \
10c954cfebSMike Rice //RUN:  | FileCheck %s --check-prefix=TCHECK
11c954cfebSMike Rice 
12c954cfebSMike Rice // expected-no-diagnostics
13c954cfebSMike Rice 
14c954cfebSMike Rice //CHECK: define {{.*}}void @[[FOO:.+]](
foo()15c954cfebSMike Rice void foo() {
16c954cfebSMike Rice   int i = 0;
17c954cfebSMike Rice 
18c954cfebSMike Rice //CHECK: call void @__omp_offloading_[[FILEID1:[0-9a-f]+_[0-9a-f]+]]_[[FOO]]_l[[T1L:[0-9]+]](
19c954cfebSMike Rice 
20c954cfebSMike Rice #define VALUE 1
21c954cfebSMike Rice #include "multiple_regions.inc"
22c954cfebSMike Rice 
23c954cfebSMike Rice //CHECK: call void @__omp_offloading_[[FILEID1]]_[[FOO]]_l[[T1L]]_1(
24c954cfebSMike Rice #undef VALUE
25c954cfebSMike Rice #define VALUE 2
26c954cfebSMike Rice #include "multiple_regions.inc"
27c954cfebSMike Rice 
28c954cfebSMike Rice //CHECK: call void @__omp_offloading_[[FILEID1]]_[[FOO]]_l[[T1L]]_2(
29c954cfebSMike Rice #undef VALUE
30c954cfebSMike Rice #define VALUE 3
31c954cfebSMike Rice #include "multiple_regions.inc"
32c954cfebSMike Rice }
33c954cfebSMike Rice 
34c954cfebSMike Rice //CHECK: define {{.*}}void @__omp_offloading_[[FILEID1]]_[[FOO]]_l[[T1L]](
35c954cfebSMike Rice //CHECK: define {{.*}}void @__omp_offloading_[[FILEID1]]_[[FOO]]_l[[T1L]]_1(
36c954cfebSMike Rice //CHECK: define {{.*}}void @__omp_offloading_[[FILEID1]]_[[FOO]]_l[[T1L]]_2(
37c954cfebSMike Rice //TCHECK: define {{.*}}void @__omp_offloading_[[FILEID1:[0-9a-f]+_[0-9a-f]+]]_[[FOO:.+]]_l[[T1L:[0-9]+]](
38c954cfebSMike Rice //TCHECK: define {{.*}}void @__omp_offloading_[[FILEID1]]_[[FOO]]_l[[T1L]]_1(
39c954cfebSMike Rice //TCHECK: define {{.*}}void @__omp_offloading_[[FILEID1]]_[[FOO]]_l[[T1L]]_2(
40c954cfebSMike Rice 
41c954cfebSMike Rice #define A()\
42c954cfebSMike Rice _Pragma("omp target")\
43c954cfebSMike Rice {}\
44c954cfebSMike Rice _Pragma("omp target")\
45c954cfebSMike Rice {}
46c954cfebSMike Rice 
47c954cfebSMike Rice //CHECK: define {{.*}}void @[[BAR:.+]](
bar()48c954cfebSMike Rice void bar()
49c954cfebSMike Rice {
50c954cfebSMike Rice //CHECK: call void @__omp_offloading_[[FILEID2:[0-9a-f]+_[0-9a-f]+]]_[[BAR]]_l[[T2L:[0-9]+]](
51c954cfebSMike Rice //CHECK: call void @__omp_offloading_[[FILEID2]]_[[BAR]]_l[[T2L]]_1(
52c954cfebSMike Rice   A()
53c954cfebSMike Rice }
54c954cfebSMike Rice 
55c954cfebSMike Rice //CHECK: define {{.*}}void @__omp_offloading_[[FILEID2]]_[[BAR]]_l[[T2L]](
56c954cfebSMike Rice //CHECK: define {{.*}}void @__omp_offloading_[[FILEID2]]_[[BAR]]_l[[T2L]]_1(
57c954cfebSMike Rice //TCHECK: define {{.*}}void @__omp_offloading_[[FILEID2:[0-9a-f]+_[0-9a-f]+]]_[[BAR:.+]]_l[[T2L:[0-9]+]](
58c954cfebSMike Rice //TCHECK: define {{.*}}void @__omp_offloading_[[FILEID2]]_[[BAR]]_l[[T2L]]_1(
59c954cfebSMike Rice 
60c954cfebSMike Rice // Check metadata is properly generated:
61c954cfebSMike Rice // CHECK:     !omp_offload.info = !{!{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}}
62c954cfebSMike Rice // CHECK-DAG: = !{i32 0, i32 {{-?[0-9]+}}, i32 {{-?[0-9]+}}, !"[[FOO]]", i32 [[T1L]], i32 0, i32 {{[0-9]+}}}
63c954cfebSMike Rice // CHECK-DAG: = !{i32 0, i32 {{-?[0-9]+}}, i32 {{-?[0-9]+}}, !"[[FOO]]", i32 [[T1L]], i32 1, i32 {{[0-9]+}}}
64c954cfebSMike Rice // CHECK-DAG: = !{i32 0, i32 {{-?[0-9]+}}, i32 {{-?[0-9]+}}, !"[[FOO]]", i32 [[T1L]], i32 2, i32 {{[0-9]+}}}
65c954cfebSMike Rice // CHECK-DAG: = !{i32 0, i32 {{-?[0-9]+}}, i32 {{-?[0-9]+}}, !"[[BAR]]", i32 [[T2L]], i32 0, i32 {{[0-9]+}}}
66c954cfebSMike Rice // CHECK-DAG: = !{i32 0, i32 {{-?[0-9]+}}, i32 {{-?[0-9]+}}, !"[[BAR]]", i32 [[T2L]], i32 1, i32 {{[0-9]+}}}
67c954cfebSMike Rice 
68c954cfebSMike Rice // TCHECK:     !omp_offload.info = !{!{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}, !{{[0-9]+}}}
69c954cfebSMike Rice // TCHECK-DAG: = !{i32 0, i32 {{-?[0-9]+}}, i32 {{-?[0-9]+}}, !"[[FOO]]", i32 [[T1L]], i32 0, i32 {{[0-9]+}}}
70c954cfebSMike Rice // TCHECK-DAG: = !{i32 0, i32 {{-?[0-9]+}}, i32 {{-?[0-9]+}}, !"[[FOO]]", i32 [[T1L]], i32 1, i32 {{[0-9]+}}}
71c954cfebSMike Rice // TCHECK-DAG: = !{i32 0, i32 {{-?[0-9]+}}, i32 {{-?[0-9]+}}, !"[[FOO]]", i32 [[T1L]], i32 2, i32 {{[0-9]+}}}
72c954cfebSMike Rice // TCHECK-DAG: = !{i32 0, i32 {{-?[0-9]+}}, i32 {{-?[0-9]+}}, !"[[BAR]]", i32 [[T2L]], i32 0, i32 {{[0-9]+}}}
73c954cfebSMike Rice // TCHECK-DAG: = !{i32 0, i32 {{-?[0-9]+}}, i32 {{-?[0-9]+}}, !"[[BAR]]", i32 [[T2L]], i32 1, i32 {{[0-9]+}}}
74