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