2018-05-11 02:32:08 +08:00
// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -fopenmp-cuda-mode -emit-llvm-bc %s -o %t-ppc-host.bc -fopenmp-version=45
// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -fopenmp-cuda-mode -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - -debug-info-kind=limited -fopenmp-version=45 | FileCheck %s
2017-08-09 02:04:06 +08:00
// expected-no-diagnostics
2018-11-08 03:11:14 +08:00
template < unsigned * ddd >
struct S {
static int a ;
} ;
extern unsigned aaa ;
template < > int S < & aaa > : : a ;
template struct S < & aaa > ;
// CHECK-NOT: @aaa
2017-08-09 02:04:06 +08:00
int main ( ) {
/* int(*b)[a]; */
/* int *(**c)[a]; */
2017-09-14 04:20:59 +08:00
bool bb ;
2017-08-09 02:04:06 +08:00
int a ;
int b [ 10 ] [ 10 ] ;
int c [ 10 ] [ 10 ] [ 10 ] ;
2017-09-14 04:20:59 +08:00
# pragma omp target parallel firstprivate(a, b) map(tofrom \
: c ) map ( tofrom \
2018-05-11 02:32:08 +08:00
: bb ) if ( target : a )
2017-08-09 02:04:06 +08:00
{
int & f = c [ 1 ] [ 1 ] [ 1 ] ;
int & g = a ;
int & h = b [ 1 ] [ 1 ] ;
int d = 15 ;
a = 5 ;
b [ 0 ] [ a ] = 10 ;
c [ 0 ] [ 0 ] [ a ] = 11 ;
b [ 0 ] [ a ] = c [ 0 ] [ 0 ] [ a ] ;
2017-09-14 04:20:59 +08:00
bb | = b [ 0 ] [ a ] ;
2017-08-09 02:04:06 +08:00
}
2017-09-14 04:20:59 +08:00
# pragma omp target parallel firstprivate(a) map(tofrom \
: c , b ) map ( to \
: bb )
2017-08-09 02:04:06 +08:00
{
int & f = c [ 1 ] [ 1 ] [ 1 ] ;
int & g = a ;
int & h = b [ 1 ] [ 1 ] ;
int d = 15 ;
a = 5 ;
b [ 0 ] [ a ] = 10 ;
c [ 0 ] [ 0 ] [ a ] = 11 ;
b [ 0 ] [ a ] = c [ 0 ] [ 0 ] [ a ] ;
2017-09-14 04:20:59 +08:00
d = bb ;
2017-08-09 02:04:06 +08:00
}
2017-09-14 04:20:59 +08:00
# pragma omp target parallel map(tofrom \
: a , c , b ) map ( from \
: bb )
2017-08-09 02:04:06 +08:00
{
int & f = c [ 1 ] [ 1 ] [ 1 ] ;
int & g = a ;
int & h = b [ 1 ] [ 1 ] ;
int d = 15 ;
a = 5 ;
b [ 0 ] [ a ] = 10 ;
c [ 0 ] [ 0 ] [ a ] = 11 ;
b [ 0 ] [ a ] = c [ 0 ] [ 0 ] [ a ] ;
2017-09-14 04:20:59 +08:00
bb = b [ 0 ] [ a ] ;
2017-08-09 02:04:06 +08:00
}
return 0 ;
}
2018-05-11 02:32:08 +08:00
// CHECK: define internal void @__omp_offloading{{[^(]+}}([10 x [10 x [10 x i32]]] addrspace(1)* {{[^,]+}}, i32 {{[^,]+}}, [10 x [10 x i32]]* {{[^,]+}}, i8 addrspace(1)* noalias{{[^,]+}})
2017-08-09 02:04:06 +08:00
// CHECK: addrspacecast [10 x [10 x [10 x i32]]] addrspace(1)* %{{.+}} to [10 x [10 x [10 x i32]]]*
2017-09-14 04:20:59 +08:00
// CHECK: call void [[NONDEBUG_WRAPPER:.+]](i32* {{[^,]+}}, i32* {{[^,]+}}, [10 x [10 x [10 x i32]]]* {{[^,]+}}, i64 {{[^,]+}}, [10 x [10 x i32]]* {{[^,]+}}, i8* {{[^)]+}})
2017-08-09 02:04:06 +08:00
2017-09-14 04:20:59 +08:00
// CHECK: define internal void [[DEBUG_PARALLEL:@.+]](i32* {{[^,]+}}, i32* {{[^,]+}}, [10 x [10 x [10 x i32]]] addrspace(1)* noalias{{[^,]+}}, i32 {{[^,]+}}, [10 x [10 x i32]]* noalias{{[^,]+}}, i8 addrspace(1)* noalias{{[^)]+}})
2017-08-09 02:04:06 +08:00
// CHECK: addrspacecast [10 x [10 x [10 x i32]]] addrspace(1)* %{{.+}} to [10 x [10 x [10 x i32]]]*
2017-09-14 04:20:59 +08:00
// CHECK: define internal void [[NONDEBUG_WRAPPER]](i32* {{[^,]+}}, i32* {{[^,]+}}, [10 x [10 x [10 x i32]]]* dereferenceable{{[^,]+}}, i64 {{[^,]+}}, [10 x [10 x i32]]* dereferenceable{{[^,]+}}, i8* dereferenceable{{[^)]+}})
2017-08-09 02:04:06 +08:00
// CHECK: addrspacecast [10 x [10 x [10 x i32]]]* %{{.+}} to [10 x [10 x [10 x i32]]] addrspace(1)*
2017-09-14 04:20:59 +08:00
// CHECK: call void [[DEBUG_PARALLEL]](i32* {{[^,]+}}, i32* {{[^,]+}}, [10 x [10 x [10 x i32]]] addrspace(1)* {{[^,]+}}, i32 {{[^,]+}}, [10 x [10 x i32]]* {{[^,]+}}, i8 addrspace(1)* {{[^)]+}})
2017-08-09 02:04:06 +08:00
2018-05-08 22:16:57 +08:00
// CHECK: define weak void @__omp_offloading_{{[^(]+}}([10 x [10 x [10 x i32]]]* dereferenceable{{[^,]+}}, i64 {{[^,]+}}, [10 x [10 x i32]]* dereferenceable{{[^,]+}}, i8* dereferenceable{{[^)]+}})
2017-08-09 02:04:06 +08:00
// CHECK: addrspacecast [10 x [10 x [10 x i32]]]* %{{.+}} to [10 x [10 x [10 x i32]]] addrspace(1)*
2017-09-14 04:20:59 +08:00
// CHECK: call void @__omp_offloading_{{[^(]+}}([10 x [10 x [10 x i32]]] addrspace(1)* {{[^,]+}}, i32 {{[^,]+}}, [10 x [10 x i32]]* {{[^,]+}}, i8 addrspace(1)* {{[^)]+}})
2017-08-09 02:04:06 +08:00
2017-09-14 04:20:59 +08:00
// CHECK: define internal void @__omp_offloading_{{[^(]+}}([10 x [10 x [10 x i32]]] addrspace(1)* noalias{{[^,]+}}, i32 {{[^,]+}}, [10 x [10 x i32]] addrspace(1)* noalias{{[^,]+}}, i8 addrspace(1)* noalias{{[^)]+}})
2017-08-09 02:04:06 +08:00
// CHECK: addrspacecast [10 x [10 x [10 x i32]]] addrspace(1)* %{{.+}} to [10 x [10 x [10 x i32]]]*
// CHECK: addrspacecast [10 x [10 x i32]] addrspace(1)* %{{.+}} to [10 x [10 x i32]]*
2017-09-14 04:20:59 +08:00
// CHECK: call void [[NONDEBUG_WRAPPER:.+]](i32* {{[^,]+}}, i32* {{[^,]+}}, [10 x [10 x [10 x i32]]]* {{[^,]+}}, i64 {{[^,]+}}, [10 x [10 x i32]]* {{[^,]+}}, i8* {{[^)]+}})
2017-08-09 02:04:06 +08:00
2017-09-14 04:20:59 +08:00
// CHECK: define internal void [[DEBUG_PARALLEL:@.+]](i32* {{[^,]+}}, i32* {{[^,]+}}, [10 x [10 x [10 x i32]]] addrspace(1)* noalias{{[^,]+}}, i32 {{[^,]+}}, [10 x [10 x i32]] addrspace(1)* noalias{{[^,]+}}, i8 addrspace(1)* {{[^)]+}})
2017-08-09 02:04:06 +08:00
// CHECK: addrspacecast [10 x [10 x [10 x i32]]] addrspace(1)* %{{.+}} to [10 x [10 x [10 x i32]]]*
// CHECK: addrspacecast [10 x [10 x i32]] addrspace(1)* %{{.+}} to [10 x [10 x i32]]*
2017-09-14 04:20:59 +08:00
// CHECK: define internal void [[NONDEBUG_WRAPPER]](i32* {{[^,]+}}, i32* {{[^,]+}}, [10 x [10 x [10 x i32]]]* dereferenceable{{[^,]+}}, i64 {{[^,]+}}, [10 x [10 x i32]]* dereferenceable{{[^,]+}}, i8* dereferenceable{{[^)]+}})
2017-08-09 02:04:06 +08:00
// CHECK: addrspacecast [10 x [10 x [10 x i32]]]* %{{.+}} to [10 x [10 x [10 x i32]]] addrspace(1)*
// CHECK: addrspacecast [10 x [10 x i32]]* %{{.+}} to [10 x [10 x i32]] addrspace(1)*
2017-09-14 04:20:59 +08:00
// CHECK: call void [[DEBUG_PARALLEL]](i32* {{[^,]+}}, i32* {{[^,]+}}, [10 x [10 x [10 x i32]]] addrspace(1)* {{[^,]+}}, i32 {{[^,]+}}, [10 x [10 x i32]] addrspace(1)* {{[^,]+}}, i8 addrspace(1)* {{[^)]+}})
2017-08-09 02:04:06 +08:00
2018-05-08 22:16:57 +08:00
// CHECK: define weak void @__omp_offloading_{{[^(]+}}([10 x [10 x [10 x i32]]]* dereferenceable{{[^,]+}}, i64 {{[^,]+}}, [10 x [10 x i32]]* dereferenceable{{[^,]+}}, i8* dereferenceable{{[^)]+}})
2017-08-09 02:04:06 +08:00
// CHECK: addrspacecast [10 x [10 x [10 x i32]]]* %{{.+}} to [10 x [10 x [10 x i32]]] addrspace(1)*
// CHECK: addrspacecast [10 x [10 x i32]]* %{{.+}} to [10 x [10 x i32]] addrspace(1)*
2017-09-14 04:20:59 +08:00
// CHECK: call void @__omp_offloading_{{[^(]+}}([10 x [10 x [10 x i32]]] addrspace(1)* {{[^,]+}}, i32 {{[^,]+}}, [10 x [10 x i32]] addrspace(1)* {{[^,]+}}, i8 addrspace(1)* {{[^)]+}})
2017-08-09 02:04:06 +08:00
2017-09-14 04:20:59 +08:00
// CHECK: define internal void @__omp_offloading_{{[^(]+}}([10 x [10 x [10 x i32]]] addrspace(1)* noalias{{[^,]+}}, i32 addrspace(1)* noalias{{[^,]+}}, [10 x [10 x i32]] addrspace(1)* noalias{{[^,]+}}, i8 addrspace(1)* noalias{{[^)]+}})
2017-08-09 02:04:06 +08:00
// CHECK: addrspacecast [10 x [10 x [10 x i32]]] addrspace(1)* %{{.+}} to [10 x [10 x [10 x i32]]]*
// CHECK: addrspacecast i32 addrspace(1)* %{{.+}} to i32*
// CHECK: addrspacecast [10 x [10 x i32]] addrspace(1)* %{{.+}} to [10 x [10 x i32]]*
2018-01-09 04:09:47 +08:00
// CHECK: call void @[[NONDEBUG_WRAPPER:.+]](i32* {{[^,]+}}, i32* {{[^,]+}}, [10 x [10 x [10 x i32]]]* {{[^,]+}}, i32* {{[^,]+}}, [10 x [10 x i32]]* {{[^,]+}}, i8* {{[^)]+}})
2017-08-09 02:04:06 +08:00
2018-01-09 04:09:47 +08:00
// CHECK: define internal void @[[DEBUG_PARALLEL:.+]](i32* {{[^,]+}}, i32* {{[^,]+}}, [10 x [10 x [10 x i32]]] addrspace(1)* noalias{{[^,]+}}, i32 addrspace(1)* noalias{{[^,]+}}, [10 x [10 x i32]] addrspace(1)* noalias{{[^,]+}}, i8 addrspace(1)* noalias{{[^)]+}})
2017-08-09 02:04:06 +08:00
// CHECK: addrspacecast [10 x [10 x [10 x i32]]] addrspace(1)* %{{.+}} to [10 x [10 x [10 x i32]]]*
// CHECK: addrspacecast i32 addrspace(1)* %{{.+}} to i32*
// CHECK: addrspacecast [10 x [10 x i32]] addrspace(1)* %{{.+}} to [10 x [10 x i32]]*
2018-01-09 04:09:47 +08:00
// CHECK: define internal void @[[NONDEBUG_WRAPPER]](i32* {{[^,]+}}, i32* {{[^,]+}}, [10 x [10 x [10 x i32]]]* dereferenceable{{[^,]+}}, i32* dereferenceable{{[^,]+}}, [10 x [10 x i32]]* dereferenceable{{[^,]+}}, i8* dereferenceable{{[^)]+}})
2017-08-10 03:38:53 +08:00
// CHECK: addrspacecast [10 x [10 x [10 x i32]]]* %{{.+}} to [10 x [10 x [10 x i32]]] addrspace(1)*
// CHECK: addrspacecast i32* %{{.+}} to i32 addrspace(1)*
// CHECK: addrspacecast [10 x [10 x i32]]* %{{.+}} to [10 x [10 x i32]] addrspace(1)*
2018-01-09 04:09:47 +08:00
// CHECK: call void @[[DEBUG_PARALLEL]](i32* {{[^,]+}}, i32* {{[^,]+}}, [10 x [10 x [10 x i32]]] addrspace(1)* {{[^,]+}}, i32 addrspace(1)* {{[^,]+}}, [10 x [10 x i32]] addrspace(1)* {{[^,]+}}, i8 addrspace(1)* {{[^)]+}})
2017-08-10 03:38:53 +08:00
2018-05-08 22:16:57 +08:00
// CHECK: define weak void @__omp_offloading_{{[^(]+}}([10 x [10 x [10 x i32]]]* dereferenceable{{[^,]+}}, i32* dereferenceable{{[^,]+}}, [10 x [10 x i32]]* dereferenceable{{[^,]+}}, i8* dereferenceable{{[^)]+}})
2017-08-10 03:38:53 +08:00
// CHECK: addrspacecast [10 x [10 x [10 x i32]]]* %{{.+}} to [10 x [10 x [10 x i32]]] addrspace(1)*
// CHECK: addrspacecast i32* %{{.+}} to i32 addrspace(1)*
// CHECK: addrspacecast [10 x [10 x i32]]* %{{.+}} to [10 x [10 x i32]] addrspace(1)*
2017-09-14 04:20:59 +08:00
// CHECK: call void @__omp_offloading_{{[^(]+}}([10 x [10 x [10 x i32]]] addrspace(1)* {{[^,]+}}, i32 addrspace(1)* {{[^,]+}}, [10 x [10 x i32]] addrspace(1)* {{[^,]+}}, i8 addrspace(1)* {{[^)]+}})
2017-08-10 03:38:53 +08:00
2017-11-23 00:02:03 +08:00
// CHECK: !DILocalVariable(name: ".global_tid.",
// CHECK-SAME: DIFlagArtificial
// CHECK: !DILocalVariable(name: ".bound_tid.",
// CHECK-SAME: DIFlagArtificial
// CHECK: !DILocalVariable(name: "c",
2018-11-08 03:11:14 +08:00
// CHECK-SAME: line: 22
2017-11-23 00:02:03 +08:00
// CHECK: !DILocalVariable(name: "a",
2018-11-08 03:11:14 +08:00
// CHECK-SAME: line: 20
2017-11-23 00:02:03 +08:00
// CHECK: !DILocalVariable(name: "b",
2018-11-08 03:11:14 +08:00
// CHECK-SAME: line: 21
2018-01-09 04:09:47 +08:00
// CHECK-DAG: distinct !DISubprogram(name: "[[NONDEBUG_WRAPPER]]",
// CHECK-DAG: distinct !DISubprogram(name: "[[DEBUG_PARALLEL]]",