diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2014-10-08 14:01:46 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2014-10-08 14:01:46 +0000 |
commit | 4a5bb772c362afeb3586b84edc3c2d0eeae31327 (patch) | |
tree | f0ae2b39368baf6bc62b8d52d9b55df12462773b /clang/test | |
parent | 34cb659103fd1818c0509daf958863f974cf7985 (diff) | |
download | bcm5719-llvm-4a5bb772c362afeb3586b84edc3c2d0eeae31327.tar.gz bcm5719-llvm-4a5bb772c362afeb3586b84edc3c2d0eeae31327.zip |
[OPENMP] Codegen for 'firstprivate' clause.
This patch generates some helper variables that used as private copies of the corresponding original variables inside an OpenMP 'parallel' directive. These generated variables are initialized by copy using values of the original variables (with the copy constructor, if any). For arrays, initializator is generated for single element and in the codegen procedure this initial value is automatically propagated between all elements of the private copy.
In outlined function, references to original variables are replaced by the references to these private helper variables. At the end of the initialization of the private variables an implicit barier is generated by calling __kmpc_barrier(...) runtime function to be sure that all threads were initialized using original values of the variables.
Differential Revision: http://reviews.llvm.org/D5140
llvm-svn: 219306
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/OpenMP/for_firstprivate_messages.cpp | 33 | ||||
-rw-r--r-- | clang/test/OpenMP/for_simd_firstprivate_messages.cpp | 30 | ||||
-rw-r--r-- | clang/test/OpenMP/parallel_codegen.cpp | 16 | ||||
-rw-r--r-- | clang/test/OpenMP/parallel_firstprivate_codegen.cpp | 171 | ||||
-rw-r--r-- | clang/test/OpenMP/parallel_firstprivate_messages.cpp | 18 | ||||
-rw-r--r-- | clang/test/OpenMP/parallel_for_firstprivate_messages.cpp | 28 | ||||
-rw-r--r-- | clang/test/OpenMP/parallel_for_simd_firstprivate_messages.cpp | 28 | ||||
-rw-r--r-- | clang/test/OpenMP/parallel_sections_firstprivate_messages.cpp | 28 | ||||
-rw-r--r-- | clang/test/OpenMP/sections_firstprivate_messages.cpp | 28 | ||||
-rw-r--r-- | clang/test/OpenMP/single_firstprivate_messages.cpp | 28 | ||||
-rw-r--r-- | clang/test/OpenMP/task_firstprivate_messages.cpp | 18 | ||||
-rw-r--r-- | clang/test/OpenMP/task_messages.cpp | 48 |
12 files changed, 328 insertions, 146 deletions
diff --git a/clang/test/OpenMP/for_firstprivate_messages.cpp b/clang/test/OpenMP/for_firstprivate_messages.cpp index f1d21b8ce5a..6aa977b65d9 100644 --- a/clang/test/OpenMP/for_firstprivate_messages.cpp +++ b/clang/test/OpenMP/for_firstprivate_messages.cpp @@ -14,7 +14,7 @@ class S2 { public: S2() : a(0) {} - S2(S2 &s2) : a(s2.a) {} + S2(const S2 &s2) : a(s2.a) {} static float S2s; static const float S2sc; }; @@ -26,23 +26,23 @@ class S3 { S3 &operator=(const S3 &s3); public: - S3() : a(0) {} - S3(S3 &s3) : a(s3.a) {} + S3() : a(0) {} // expected-note {{candidate constructor not viable: requires 0 arguments, but 1 was provided}} + S3(S3 &s3) : a(s3.a) {} // expected-note {{candidate constructor not viable: 1st argument ('const S3') would lose const qualifier}} }; const S3 c; const S3 ca[5]; extern const int f; -class S4 { // expected-note 2 {{'S4' declared here}} +class S4 { int a; S4(); - S4(const S4 &s4); + S4(const S4 &s4); // expected-note 2 {{implicitly declared private here}} public: S4(int v) : a(v) {} }; -class S5 { // expected-note 4 {{'S5' declared here}} +class S5 { int a; - S5(const S5 &s5) : a(s5.a) {} + S5(const S5 &s5) : a(s5.a) {} // expected-note 4 {{implicitly declared private here}} public: S5() : a(0) {} @@ -62,8 +62,8 @@ S3 h; template <class I, class C> int foomain(int argc, char **argv) { - I e(4); // expected-note {{'e' defined here}} - C g(5); // expected-note 2 {{'g' defined here}} + I e(4); + C g(5); int i; int &j = i; // expected-note {{'j' defined here}} #pragma omp parallel @@ -107,7 +107,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel -#pragma omp for firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp for firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel @@ -138,7 +138,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel -#pragma omp for lastprivate(g) firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp for lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}} for (i = 0; i < argc; ++i) foo(); #pragma omp parallel private(i) // expected-note {{defined as private}} @@ -155,8 +155,8 @@ int foomain(int argc, char **argv) { int main(int argc, char **argv) { const int d = 5; const int da[5] = {0}; - S4 e(4); // expected-note {{'e' defined here}} - S5 g(5); // expected-note 2 {{'g' defined here}} + S4 e(4); + S5 g(5); S3 m; S6 n(2); int i; @@ -194,7 +194,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp parallel -#pragma omp for firstprivate(a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} +#pragma omp for firstprivate(a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} expected-error {{no matching constructor for initialization of 'const S3'}} for (i = 0; i < argc; ++i) foo(); #pragma omp parallel @@ -235,7 +235,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp parallel -#pragma omp for firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp for firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} for (i = 0; i < argc; ++i) foo(); #pragma omp parallel @@ -263,7 +263,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp parallel -#pragma omp for lastprivate(g) firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp for lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}} for (i = 0; i < argc; ++i) foo(); #pragma omp parallel @@ -291,3 +291,4 @@ int main(int argc, char **argv) { return foomain<S4, S5>(argc, argv); // expected-note {{in instantiation of function template specialization 'foomain<S4, S5>' requested here}} } + diff --git a/clang/test/OpenMP/for_simd_firstprivate_messages.cpp b/clang/test/OpenMP/for_simd_firstprivate_messages.cpp index 629a5b85295..1345bfc9886 100644 --- a/clang/test/OpenMP/for_simd_firstprivate_messages.cpp +++ b/clang/test/OpenMP/for_simd_firstprivate_messages.cpp @@ -14,7 +14,7 @@ class S2 { public: S2() : a(0) {} - S2(S2 &s2) : a(s2.a) {} + S2(const S2 &s2) : a(s2.a) {} static float S2s; static const float S2sc; }; @@ -27,22 +27,22 @@ class S3 { public: S3() : a(0) {} - S3(S3 &s3) : a(s3.a) {} + S3(const S3 &s3) : a(s3.a) {} }; const S3 c; const S3 ca[5]; extern const int f; -class S4 { // expected-note 2 {{'S4' declared here}} +class S4 { int a; S4(); - S4(const S4 &s4); + S4(const S4 &s4); // expected-note 2 {{implicitly declared private here}} public: S4(int v) : a(v) {} }; -class S5 { // expected-note 4 {{'S5' declared here}} +class S5 { int a; - S5(const S5 &s5) : a(s5.a) {} + S5(const S5 &s5) : a(s5.a) {} // expected-note 4 {{implicitly declared private here}} public: S5() : a(0) {} @@ -62,8 +62,8 @@ S3 h; template <class I, class C> int foomain(int argc, char **argv) { - I e(4); // expected-note {{'e' defined here}} - C g(5); // expected-note 2 {{'g' defined here}} + I e(4); + C g(5); int i; int &j = i; // expected-note {{'j' defined here}} #pragma omp parallel @@ -99,7 +99,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel -#pragma omp for simd firstprivate(a, b) // expected-error {{firstprivate variable with incomplete type 'S1'}} +#pragma omp for simd firstprivate(a, b) // expected-error {{a firstprivate variable with incomplete type 'S1'}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel @@ -107,7 +107,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel -#pragma omp for simd firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp for simd firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel @@ -138,7 +138,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel -#pragma omp for simd lastprivate(g) firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp for simd lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}} for (i = 0; i < argc; ++i) foo(); #pragma omp parallel private(i) // expected-note {{defined as private}} @@ -155,8 +155,8 @@ int foomain(int argc, char **argv) { int main(int argc, char **argv) { const int d = 5; const int da[5] = {0}; - S4 e(4); // expected-note {{'e' defined here}} - S5 g(5); // expected-note 2 {{'g' defined here}} + S4 e(4); + S5 g(5); S3 m; S6 n(2); int i; @@ -235,7 +235,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp parallel -#pragma omp for simd firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp for simd firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} for (i = 0; i < argc; ++i) foo(); #pragma omp parallel @@ -263,7 +263,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp parallel -#pragma omp for simd lastprivate(g) firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp for simd lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}} for (i = 0; i < argc; ++i) foo(); #pragma omp parallel diff --git a/clang/test/OpenMP/parallel_codegen.cpp b/clang/test/OpenMP/parallel_codegen.cpp index d9ff5ac0233..e50ab43c280 100644 --- a/clang/test/OpenMP/parallel_codegen.cpp +++ b/clang/test/OpenMP/parallel_codegen.cpp @@ -39,7 +39,7 @@ int main (int argc, char **argv) { // CHECK: [[ARGC_REF:%.+]] = getelementptr inbounds %struct.anon* [[AGG_CAPTURED]], i32 0, i32 0 // CHECK-NEXT: store i32* {{%[a-z0-9.]+}}, i32** [[ARGC_REF]] // CHECK-NEXT: [[BITCAST:%.+]] = bitcast %struct.anon* [[AGG_CAPTURED]] to i8* -// CHECK-NEXT: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...)* @__kmpc_fork_call(%ident_t* [[DEF_LOC_2]], i32 1, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, %struct.anon*)* @__captured_stmt to void (i32*, i32*, ...)*), i8* [[BITCAST]]) +// CHECK-NEXT: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...)* @__kmpc_fork_call(%ident_t* [[DEF_LOC_2]], i32 1, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, %struct.anon*)* @.omp_outlined. to void (i32*, i32*, ...)*), i8* [[BITCAST]]) // CHECK-NEXT: [[ARGV:%.+]] = load i8*** {{%[a-z0-9.]+}} // CHECK-NEXT: [[RET:%.+]] = call {{[a-z]*[ ]?i32}} [[TMAIN:@.+tmain.+]](i8** [[ARGV]]) // CHECK-NEXT: ret i32 [[RET]] @@ -55,13 +55,13 @@ int main (int argc, char **argv) { // CHECK-DEBUG-NEXT: [[KMPC_LOC_PSOURCE_REF:%.+]] = getelementptr inbounds %ident_t* [[LOC_2_ADDR]], i32 0, i32 4 // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.+}} x i8]* [[LOC1]], i32 0, i32 0), i8** [[KMPC_LOC_PSOURCE_REF]] // CHECK-DEBUG-NEXT: [[BITCAST:%.+]] = bitcast %struct.anon* [[AGG_CAPTURED]] to i8* -// CHECK-DEBUG-NEXT: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...)* @__kmpc_fork_call(%ident_t* [[LOC_2_ADDR]], i32 1, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, %struct.anon*)* @__captured_stmt to void (i32*, i32*, ...)*), i8* [[BITCAST]]) +// CHECK-DEBUG-NEXT: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...)* @__kmpc_fork_call(%ident_t* [[LOC_2_ADDR]], i32 1, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, %struct.anon*)* @.omp_outlined. to void (i32*, i32*, ...)*), i8* [[BITCAST]]) // CHECK-DEBUG-NEXT: [[ARGV:%.+]] = load i8*** {{%[a-z0-9.]+}} // CHECK-DEBUG-NEXT: [[RET:%.+]] = call i32 [[TMAIN:@.+tmain.+]](i8** [[ARGV]]) // CHECK-DEBUG-NEXT: ret i32 [[RET]] // CHECK-DEBUG-NEXT: } -// CHECK-LABEL: define internal void @__captured_stmt(i32* %.global_tid., i32* %.bound_tid., %struct.anon* %__context) +// CHECK-LABEL: define internal void @.omp_outlined.(i32* %.global_tid., i32* %.bound_tid., %struct.anon* %__context) // CHECK: [[CONTEXT_ADDR:%.+]] = alloca %struct.anon* // CHECK: store %struct.anon* %__context, %struct.anon** [[CONTEXT_ADDR]] // CHECK: [[CONTEXT_PTR:%.+]] = load %struct.anon** [[CONTEXT_ADDR]] @@ -73,7 +73,7 @@ int main (int argc, char **argv) { // CHECK: call void @{{.+terminate.*}}( // CHECK-NEXT: unreachable // CHECK-NEXT: } -// CHECK-DEBUG-LABEL: define internal void @__captured_stmt(i32* %.global_tid., i32* %.bound_tid., %struct.anon* %__context) +// CHECK-DEBUG-LABEL: define internal void @.omp_outlined.(i32* %.global_tid., i32* %.bound_tid., %struct.anon* %__context) // CHECK-DEBUG: [[CONTEXT_ADDR:%.+]] = alloca %struct.anon* // CHECK-DEBUG: store %struct.anon* %__context, %struct.anon** [[CONTEXT_ADDR]] // CHECK-DEBUG: [[CONTEXT_PTR:%.+]] = load %struct.anon** [[CONTEXT_ADDR]] @@ -96,7 +96,7 @@ int main (int argc, char **argv) { // CHECK: [[ARGC_REF:%.+]] = getelementptr inbounds %struct.anon.0* [[AGG_CAPTURED]], i32 0, i32 0 // CHECK-NEXT: store i8*** {{%[a-z0-9.]+}}, i8**** [[ARGC_REF]] // CHECK-NEXT: [[BITCAST:%.+]] = bitcast %struct.anon.0* [[AGG_CAPTURED]] to i8* -// CHECK-NEXT: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...)* @__kmpc_fork_call(%ident_t* [[DEF_LOC_2]], i32 1, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, %struct.anon.0*)* @__captured_stmt1 to void (i32*, i32*, ...)*), i8* [[BITCAST]]) +// CHECK-NEXT: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...)* @__kmpc_fork_call(%ident_t* [[DEF_LOC_2]], i32 1, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, %struct.anon.0*)* @.omp_outlined.1 to void (i32*, i32*, ...)*), i8* [[BITCAST]]) // CHECK-NEXT: ret i32 0 // CHECK-NEXT: } // CHECK-DEBUG: define linkonce_odr i32 [[TMAIN]](i8** %argc) @@ -110,11 +110,11 @@ int main (int argc, char **argv) { // CHECK-DEBUG-NEXT: [[KMPC_LOC_PSOURCE_REF:%.+]] = getelementptr inbounds %ident_t* [[LOC_2_ADDR]], i32 0, i32 4 // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.+}} x i8]* [[LOC2]], i32 0, i32 0), i8** [[KMPC_LOC_PSOURCE_REF]] // CHECK-DEBUG-NEXT: [[BITCAST:%.+]] = bitcast %struct.anon.0* [[AGG_CAPTURED]] to i8* -// CHECK-DEBUG-NEXT: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...)* @__kmpc_fork_call(%ident_t* [[LOC_2_ADDR]], i32 1, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, %struct.anon.0*)* @__captured_stmt1 to void (i32*, i32*, ...)*), i8* [[BITCAST]]) +// CHECK-DEBUG-NEXT: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...)* @__kmpc_fork_call(%ident_t* [[LOC_2_ADDR]], i32 1, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, %struct.anon.0*)* @.omp_outlined.1 to void (i32*, i32*, ...)*), i8* [[BITCAST]]) // CHECK-DEBUG-NEXT: ret i32 0 // CHECK-DEBUG-NEXT: } -// CHECK-LABEL: define internal void @__captured_stmt1(i32* %.global_tid., i32* %.bound_tid., %struct.anon.0* %__context) +// CHECK-LABEL: define internal void @.omp_outlined.1(i32* %.global_tid., i32* %.bound_tid., %struct.anon.0* %__context) // CHECK: [[CONTEXT_ADDR:%.+]] = alloca %struct.anon.0* // CHECK: store %struct.anon.0* %__context, %struct.anon.0** [[CONTEXT_ADDR]] // CHECK: [[CONTEXT_PTR:%.+]] = load %struct.anon.0** [[CONTEXT_ADDR]] @@ -126,7 +126,7 @@ int main (int argc, char **argv) { // CHECK: call void @{{.+terminate.*}}( // CHECK-NEXT: unreachable // CHECK-NEXT: } -// CHECK-DEBUG-LABEL: define internal void @__captured_stmt1(i32* %.global_tid., i32* %.bound_tid., %struct.anon.0* %__context) +// CHECK-DEBUG-LABEL: define internal void @.omp_outlined.1(i32* %.global_tid., i32* %.bound_tid., %struct.anon.0* %__context) // CHECK-DEBUG: [[CONTEXT_ADDR:%.+]] = alloca %struct.anon.0* // CHECK-DEBUG: store %struct.anon.0* %__context, %struct.anon.0** [[CONTEXT_ADDR]] // CHECK-DEBUG: [[CONTEXT_PTR:%.+]] = load %struct.anon.0** [[CONTEXT_ADDR]] diff --git a/clang/test/OpenMP/parallel_firstprivate_codegen.cpp b/clang/test/OpenMP/parallel_firstprivate_codegen.cpp new file mode 100644 index 00000000000..d740ef981c4 --- /dev/null +++ b/clang/test/OpenMP/parallel_firstprivate_codegen.cpp @@ -0,0 +1,171 @@ +// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -x c++ -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -std=c++11 -triple x86_64-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -triple x86_64-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +struct St { + int a, b; + St() : a(0), b(0) {} + St(const St &st) : a(st.a + st.b), b(0) {} + ~St() {} +}; + +volatile int g; + +template <class T> +struct S { + T f; + S(T a) : f(a + g) {} + S() : f(g) {} + S(const S &s, St t = St()) : f(s.f + t.a) {} + operator T() { return T(); } + ~S() {} +}; + +// CHECK-DAG: [[S_FLOAT_TY:%.+]] = type { float } +// CHECK-DAG: [[S_INT_TY:%.+]] = type { i{{[0-9]+}} } +// CHECK-DAG: [[ST_TY:%.+]] = type { i{{[0-9]+}}, i{{[0-9]+}} } +// CHECK-DAG: [[CAP_MAIN_TY:%.+]] = type { [2 x i{{[0-9]+}}]*, i{{[0-9]+}}*, [2 x [[S_FLOAT_TY]]]*, [[S_FLOAT_TY]]* } +// CHECK-DAG: [[CAP_TMAIN_TY:%.+]] = type { [2 x i{{[0-9]+}}]*, i{{[0-9]+}}*, [2 x [[S_INT_TY]]]*, [[S_INT_TY]]* } +// CHECK-DAG: [[IMPLICIT_BARRIER_LOC:@.+]] = private unnamed_addr constant %{{.+}} { i32 0, i32 66, i32 0, i32 0, i8* + +template <typename T> +T tmain() { + S<T> test; + T t_var = T(); + T vec[] = {1, 2}; + S<T> s_arr[] = {1, 2}; + S<T> var(3); +#pragma omp parallel firstprivate(t_var, vec, s_arr, var) + { + vec[0] = t_var; + s_arr[0] = var; + } + return T(); +} + +int main() { + S<float> test; + int t_var = 0; + int vec[] = {1, 2}; + S<float> s_arr[] = {1, 2}; + S<float> var(3); +#pragma omp parallel firstprivate(t_var, vec, s_arr, var) + { + vec[0] = t_var; + s_arr[0] = var; + } + return tmain<int>(); +} + +// CHECK: define i{{[0-9]+}} @main() +// CHECK: [[TEST:%.+]] = alloca [[S_FLOAT_TY]], +// CHECK: call void [[S_FLOAT_TY_DEF_CONSTR:@.+]]([[S_FLOAT_TY]]* [[TEST]]) +// CHECK: %{{.+}} = bitcast [[CAP_MAIN_TY]]* +// CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...)* @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [[CAP_MAIN_TY]]*)* [[MAIN_MICROTASK:@.+]] to void +// CHECK: = call i{{.+}} [[TMAIN_INT:@.+]]() +// CHECK: call void [[S_FLOAT_TY_DESTR:@.+]]([[S_FLOAT_TY]]* +// CHECK: ret +// +// CHECK: define internal void [[MAIN_MICROTASK]](i{{[0-9]+}}* [[GTID_ADDR:%.+]], i{{[0-9]+}}* %{{.+}}, [[CAP_MAIN_TY]]* %{{.+}}) +// CHECK: [[T_VAR_PRIV:%.+]] = alloca i{{[0-9]+}}, +// CHECK: [[VEC_PRIV:%.+]] = alloca [2 x i{{[0-9]+}}], +// CHECK: [[S_ARR_PRIV:%.+]] = alloca [2 x [[S_FLOAT_TY]]], +// CHECK: [[VAR_PRIV:%.+]] = alloca [[S_FLOAT_TY]], +// CHECK: [[GTID:%.+]] = load i{{[0-9]+}}* [[GTID_ADDR]] +// CHECK: [[T_VAR_PTR_REF:%.+]] = getelementptr inbounds [[CAP_MAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 1 +// CHECK: [[T_VAR_REF:%.+]] = load i{{[0-9]+}}** [[T_VAR_PTR_REF]], +// CHECK: [[T_VAR_VAL:%.+]] = load i{{[0-9]+}}* [[T_VAR_REF]], +// CHECK: store i{{[0-9]+}} [[T_VAR_VAL]], i{{[0-9]+}}* [[T_VAR_PRIV]], +// CHECK: [[VEC_PTR_REF:%.+]] = getelementptr inbounds [[CAP_MAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 0 +// CHECK: [[VEC_REF:%.+]] = load [2 x i{{[0-9]+}}]** [[VEC_PTR_REF:%.+]], +// CHECK: br label %[[VEC_PRIV_INIT:.+]] +// CHECK: [[VEC_PRIV_INIT]] +// CHECK: [[VEC_DEST:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_PRIV]] to i8* +// CHECK: [[VEC_SRC:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_REF]] to i8* +// CHECK: call void @llvm.memcpy.{{.+}}(i8* [[VEC_DEST]], i8* [[VEC_SRC]], +// CHECK: br label %[[VEC_PRIV_INIT_END:.+]] +// CHECK: [[VEC_PRIV_INIT_END]] +// CHECK: [[S_ARR_REF_PTR:%.+]] = getelementptr inbounds [[CAP_MAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 2 +// CHECK: [[S_ARR_REF:%.+]] = load [2 x [[S_FLOAT_TY]]]** [[S_ARR_REF_PTR]], +// CHECK: br label %[[S_ARR_PRIV_INIT:.+]] +// CHECK: [[S_ARR_PRIV_INIT]] +// CHECK: [[S_ARR_BEGIN:%.+]] = getelementptr inbounds [2 x [[S_FLOAT_TY]]]* [[S_ARR_REF]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 +// CHECK: [[S_ARR_PRIV_BEGIN:%.+]] = getelementptr inbounds [2 x [[S_FLOAT_TY]]]* [[S_ARR_PRIV]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 +// CHECK: [[S_ARR_END:%.+]] = getelementptr [[S_FLOAT_TY]]* [[S_ARR_BEGIN]], i{{[0-9]+}} 2 +// CHECK: [[S_ARR_PRIV_END:%.+]] = getelementptr [[S_FLOAT_TY]]* [[S_ARR_PRIV_BEGIN]], i{{[0-9]+}} 2 +// CHECK: [[IS_EMPTY:%.+]] = icmp eq [[S_FLOAT_TY]]* [[S_ARR_PRIV_BEGIN]], [[S_ARR_PRIV_END]] +// CHECK: br i1 [[IS_EMPTY]], label %[[S_ARR_BODY_DONE:.+]], label %[[S_ARR_BODY:.+]] +// CHECK: [[S_ARR_BODY]] +// CHECK: call void [[ST_TY_DEFAULT_CONSTR:@.+]]([[ST_TY]]* [[ST_TY_TEMP:%.+]]) +// CHECK: call void [[S_FLOAT_TY_COPY_CONSTR:@.+]]([[S_FLOAT_TY]]* {{.+}}, [[S_FLOAT_TY]]* {{.+}}, [[ST_TY]]* [[ST_TY_TEMP]]) +// CHECK: call void [[ST_TY_DESTR:@.+]]([[ST_TY]]* [[ST_TY_TEMP]]) +// CHECK: br i1 {{.+}}, label %{{.+}}, label %[[S_ARR_BODY]] +// CHECK: br label %[[S_ARR_PRIV_INIT_END:.+]] +// CHECK: [[S_ARR_PRIV_INIT_END]] +// CHECK: [[VAR_REF_PTR:%.+]] = getelementptr inbounds [[CAP_MAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 3 +// CHECK: [[VAR_REF:%.+]] = load [[S_FLOAT_TY]]** [[VAR_REF_PTR]], +// CHECK: call void [[ST_TY_DEFAULT_CONSTR]]([[ST_TY]]* [[ST_TY_TEMP:%.+]]) +// CHECK: call void [[S_FLOAT_TY_COPY_CONSTR]]([[S_FLOAT_TY]]* [[VAR_PRIV]], [[S_FLOAT_TY]]* {{.*}} [[VAR_REF]], [[ST_TY]]* [[ST_TY_TEMP]]) +// CHECK: call void [[ST_TY_DESTR]]([[ST_TY]]* [[ST_TY_TEMP]]) +// CHECK: call void @__kmpc_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) +// CHECK-DAG: call void [[S_FLOAT_TY_DESTR]]([[S_FLOAT_TY]]* [[VAR_PRIV]]) +// CHECK-DAG: call void [[S_FLOAT_TY_DESTR]]([[S_FLOAT_TY]]* +// CHECK: ret void + +// CHECK: define {{.*}} i{{[0-9]+}} [[TMAIN_INT]]() +// CHECK: [[TEST:%.+]] = alloca [[S_INT_TY]], +// CHECK: call void [[S_INT_TY_DEF_CONSTR:@.+]]([[S_INT_TY]]* [[TEST]]) +// CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...)* @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [[CAP_TMAIN_TY]]*)* [[TMAIN_MICROTASK:@.+]] to void +// CHECK: call void [[S_INT_TY_DESTR:@.+]]([[S_INT_TY]]* +// CHECK: ret +// +// CHECK: define internal void [[TMAIN_MICROTASK]](i{{[0-9]+}}* [[GTID_ADDR:%.+]], i{{[0-9]+}}* %{{.+}}, [[CAP_TMAIN_TY]]* %{{.+}}) +// CHECK: [[T_VAR_PRIV:%.+]] = alloca i{{[0-9]+}}, +// CHECK: [[VEC_PRIV:%.+]] = alloca [2 x i{{[0-9]+}}], +// CHECK: [[S_ARR_PRIV:%.+]] = alloca [2 x [[S_INT_TY]]], +// CHECK: [[VAR_PRIV:%.+]] = alloca [[S_INT_TY]], +// CHECK: [[GTID:%.+]] = load i{{[0-9]+}}* [[GTID_ADDR]] +// CHECK: [[T_VAR_PTR_REF:%.+]] = getelementptr inbounds [[CAP_TMAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 1 +// CHECK: [[T_VAR_REF:%.+]] = load i{{[0-9]+}}** [[T_VAR_PTR_REF]], +// CHECK: [[T_VAR_VAL:%.+]] = load i{{[0-9]+}}* [[T_VAR_REF]], +// CHECK: store i{{[0-9]+}} [[T_VAR_VAL]], i{{[0-9]+}}* [[T_VAR_PRIV]], +// CHECK: [[VEC_PTR_REF:%.+]] = getelementptr inbounds [[CAP_TMAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 0 +// CHECK: [[VEC_REF:%.+]] = load [2 x i{{[0-9]+}}]** [[VEC_PTR_REF:%.+]], +// CHECK: br label %[[VEC_PRIV_INIT:.+]] +// CHECK: [[VEC_PRIV_INIT]] +// CHECK: [[VEC_DEST:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_PRIV]] to i8* +// CHECK: [[VEC_SRC:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_REF]] to i8* +// CHECK: call void @llvm.memcpy.{{.+}}(i8* [[VEC_DEST]], i8* [[VEC_SRC]], +// CHECK: br label %[[VEC_PRIV_INIT_END:.+]] +// CHECK: [[VEC_PRIV_INIT_END]] +// CHECK: [[S_ARR_REF_PTR:%.+]] = getelementptr inbounds [[CAP_TMAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 2 +// CHECK: [[S_ARR_REF:%.+]] = load [2 x [[S_INT_TY]]]** [[S_ARR_REF_PTR]], +// CHECK: br label %[[S_ARR_PRIV_INIT:.+]] +// CHECK: [[S_ARR_PRIV_INIT]] +// CHECK: [[S_ARR_BEGIN:%.+]] = getelementptr inbounds [2 x [[S_INT_TY]]]* [[S_ARR_REF]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 +// CHECK: [[S_ARR_PRIV_BEGIN:%.+]] = getelementptr inbounds [2 x [[S_INT_TY]]]* [[S_ARR_PRIV]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 +// CHECK: [[S_ARR_END:%.+]] = getelementptr [[S_INT_TY]]* [[S_ARR_BEGIN]], i{{[0-9]+}} 2 +// CHECK: [[S_ARR_PRIV_END:%.+]] = getelementptr [[S_INT_TY]]* [[S_ARR_PRIV_BEGIN]], i{{[0-9]+}} 2 +// CHECK: [[IS_EMPTY:%.+]] = icmp eq [[S_INT_TY]]* [[S_ARR_PRIV_BEGIN]], [[S_ARR_PRIV_END]] +// CHECK: br i1 [[IS_EMPTY]], label %[[S_ARR_BODY_DONE:.+]], label %[[S_ARR_BODY:.+]] +// CHECK: [[S_ARR_BODY]] +// CHECK: call void [[ST_TY_DEFAULT_CONSTR]]([[ST_TY]]* [[ST_TY_TEMP:%.+]]) +// CHECK: call void [[S_INT_TY_COPY_CONSTR:@.+]]([[S_INT_TY]]* {{.+}}, [[S_INT_TY]]* {{.+}}, [[ST_TY]]* [[ST_TY_TEMP]]) +// CHECK: call void [[ST_TY_DESTR]]([[ST_TY]]* [[ST_TY_TEMP]]) +// CHECK: br i1 {{.+}}, label %{{.+}}, label %[[S_ARR_BODY]] +// CHECK: br label %[[S_ARR_PRIV_INIT_END:.+]] +// CHECK: [[S_ARR_PRIV_INIT_END]] +// CHECK: [[VAR_REF_PTR:%.+]] = getelementptr inbounds [[CAP_TMAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 3 +// CHECK: [[VAR_REF:%.+]] = load [[S_INT_TY]]** [[VAR_REF_PTR]], +// CHECK: call void [[ST_TY_DEFAULT_CONSTR]]([[ST_TY]]* [[ST_TY_TEMP:%.+]]) +// CHECK: call void [[S_INT_TY_COPY_CONSTR]]([[S_INT_TY]]* [[VAR_PRIV]], [[S_INT_TY]]* {{.*}} [[VAR_REF]], [[ST_TY]]* [[ST_TY_TEMP]]) +// CHECK: call void [[ST_TY_DESTR]]([[ST_TY]]* [[ST_TY_TEMP]]) +// CHECK: call void @__kmpc_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) +// CHECK-DAG: call void [[S_INT_TY_DESTR]]([[S_INT_TY]]* [[VAR_PRIV]]) +// CHECK-DAG: call void [[S_INT_TY_DESTR]]([[S_INT_TY]]* +// CHECK: ret void +#endif + diff --git a/clang/test/OpenMP/parallel_firstprivate_messages.cpp b/clang/test/OpenMP/parallel_firstprivate_messages.cpp index 9df45c60e70..7d1e3593500 100644 --- a/clang/test/OpenMP/parallel_firstprivate_messages.cpp +++ b/clang/test/OpenMP/parallel_firstprivate_messages.cpp @@ -13,7 +13,7 @@ class S2 { mutable int a; public: S2():a(0) { } - S2(S2 &s2):a(s2.a) { } + S2(const S2 &s2):a(s2.a) { } static float S2s; static const float S2sc; }; @@ -24,22 +24,22 @@ class S3 { int a; public: S3():a(0) { } - S3(S3 &s3):a(s3.a) { } + S3(const S3 &s3):a(s3.a) { } }; const S3 c; const S3 ca[5]; extern const int f; -class S4 { // expected-note {{'S4' declared here}} +class S4 { int a; S4(); - S4(const S4 &s4); + S4(const S4 &s4); // expected-note {{implicitly declared private here}} public: S4(int v):a(v) { } }; -class S5 { // expected-note {{'S5' declared here}} +class S5 { int a; S5():a(0) {} - S5(const S5 &s5):a(s5.a) { } + S5(const S5 &s5):a(s5.a) { } // expected-note {{implicitly declared private here}} public: S5(int v):a(v) { } }; @@ -50,8 +50,8 @@ S3 h; int main(int argc, char **argv) { const int d = 5; const int da[5] = { 0 }; - S4 e(4); // expected-note {{'e' defined here}} - S5 g(5); // expected-note {{'g' defined here}} + S4 e(4); + S5 g(5); int i; int &j = i; // expected-note {{'j' defined here}} #pragma omp parallel firstprivate // expected-error {{expected '(' after 'firstprivate'}} @@ -69,7 +69,7 @@ int main(int argc, char **argv) { #pragma omp parallel firstprivate(da) #pragma omp parallel firstprivate(S2::S2s) #pragma omp parallel firstprivate(S2::S2sc) - #pragma omp parallel firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} + #pragma omp parallel firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} #pragma omp parallel firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} #pragma omp parallel private(i), firstprivate(i) // expected-error {{private variable cannot be firstprivate}} expected-note{{defined as private}} foo(); diff --git a/clang/test/OpenMP/parallel_for_firstprivate_messages.cpp b/clang/test/OpenMP/parallel_for_firstprivate_messages.cpp index 99dd68f3cbf..b4958733dec 100644 --- a/clang/test/OpenMP/parallel_for_firstprivate_messages.cpp +++ b/clang/test/OpenMP/parallel_for_firstprivate_messages.cpp @@ -14,7 +14,7 @@ class S2 { public: S2() : a(0) {} - S2(S2 &s2) : a(s2.a) {} + S2(const S2 &s2) : a(s2.a) {} static float S2s; static const float S2sc; }; @@ -27,22 +27,22 @@ class S3 { public: S3() : a(0) {} - S3(S3 &s3) : a(s3.a) {} + S3(const S3 &s3) : a(s3.a) {} }; const S3 c; const S3 ca[5]; extern const int f; -class S4 { // expected-note 2 {{'S4' declared here}} +class S4 { int a; S4(); - S4(const S4 &s4); + S4(const S4 &s4); // expected-note 2 {{implicitly declared private here}} public: S4(int v) : a(v) {} }; -class S5 { // expected-note 4 {{'S5' declared here}} +class S5 { int a; - S5(const S5 &s5) : a(s5.a) {} + S5(const S5 &s5) : a(s5.a) {} // expected-note 4 {{implicitly declared private here}} public: S5() : a(0) {} @@ -62,8 +62,8 @@ S3 h; template <class I, class C> int foomain(int argc, char **argv) { - I e(4); // expected-note {{'e' defined here}} - C g(5); // expected-note 2 {{'g' defined here}} + I e(4); + C g(5); int i; int &j = i; // expected-note {{'j' defined here}} #pragma omp parallel for firstprivate // expected-error {{expected '(' after 'firstprivate'}} @@ -96,7 +96,7 @@ int foomain(int argc, char **argv) { #pragma omp parallel for firstprivate(argv[1]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp parallel for firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp parallel for firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel for firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} @@ -123,7 +123,7 @@ int foomain(int argc, char **argv) { #pragma omp parallel for firstprivate(i) for (int k = 0; k < argc; ++k) ++k; -#pragma omp parallel for lastprivate(g) firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp parallel for lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}} for (i = 0; i < argc; ++i) foo(); #pragma omp parallel private(i) @@ -140,8 +140,8 @@ int foomain(int argc, char **argv) { int main(int argc, char **argv) { const int d = 5; const int da[5] = {0}; - S4 e(4); // expected-note {{'e' defined here}} - S5 g(5); // expected-note 2 {{'g' defined here}} + S4 e(4); + S5 g(5); S3 m; S6 n(2); int i; @@ -201,7 +201,7 @@ int main(int argc, char **argv) { #pragma omp parallel for safelen(5) // expected-error {{unexpected OpenMP clause 'safelen' in directive '#pragma omp parallel for'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp parallel for firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp parallel for firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} for (i = 0; i < argc; ++i) foo(); #pragma omp parallel for firstprivate(m) // OK @@ -223,7 +223,7 @@ int main(int argc, char **argv) { #pragma omp parallel for firstprivate(j) // expected-error {{arguments of OpenMP clause 'firstprivate' cannot be of reference type}} for (i = 0; i < argc; ++i) foo(); -#pragma omp parallel for lastprivate(g) firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp parallel for lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}} for (i = 0; i < argc; ++i) foo(); #pragma omp parallel for lastprivate(n) firstprivate(n) // OK diff --git a/clang/test/OpenMP/parallel_for_simd_firstprivate_messages.cpp b/clang/test/OpenMP/parallel_for_simd_firstprivate_messages.cpp index f76d1fc9496..876d422e634 100644 --- a/clang/test/OpenMP/parallel_for_simd_firstprivate_messages.cpp +++ b/clang/test/OpenMP/parallel_for_simd_firstprivate_messages.cpp @@ -14,7 +14,7 @@ class S2 { public: S2() : a(0) {} - S2(S2 &s2) : a(s2.a) {} + S2(const S2 &s2) : a(s2.a) {} static float S2s; static const float S2sc; }; @@ -27,22 +27,22 @@ class S3 { public: S3() : a(0) {} - S3(S3 &s3) : a(s3.a) {} + S3(const S3 &s3) : a(s3.a) {} }; const S3 c; const S3 ca[5]; extern const int f; -class S4 { // expected-note 2 {{'S4' declared here}} +class S4 { int a; S4(); - S4(const S4 &s4); + S4(const S4 &s4); // expected-note 2 {{implicitly declared private here}} public: S4(int v) : a(v) {} }; -class S5 { // expected-note 4 {{'S5' declared here}} +class S5 { int a; - S5(const S5 &s5) : a(s5.a) {} + S5(const S5 &s5) : a(s5.a) {} // expected-note 4 {{implicitly declared private here}} public: S5() : a(0) {} @@ -62,8 +62,8 @@ S3 h; template <class I, class C> int foomain(int argc, char **argv) { - I e(4); // expected-note {{'e' defined here}} - C g(5); // expected-note 2 {{'g' defined here}} + I e(4); + C g(5); int i; int &j = i; // expected-note {{'j' defined here}} #pragma omp parallel for simd firstprivate // expected-error {{expected '(' after 'firstprivate'}} @@ -96,7 +96,7 @@ int foomain(int argc, char **argv) { #pragma omp parallel for simd firstprivate(argv[1]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp parallel for simd firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp parallel for simd firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel for simd firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} @@ -122,7 +122,7 @@ int foomain(int argc, char **argv) { #pragma omp parallel for simd firstprivate(i) for (int k = 0; k < argc; ++k) ++k; -#pragma omp parallel for simd lastprivate(g) firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp parallel for simd lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}} for (i = 0; i < argc; ++i) foo(); #pragma omp parallel private(i) @@ -139,8 +139,8 @@ int foomain(int argc, char **argv) { int main(int argc, char **argv) { const int d = 5; const int da[5] = {0}; - S4 e(4); // expected-note {{'e' defined here}} - S5 g(5); // expected-note 2 {{'g' defined here}} + S4 e(4); + S5 g(5); S3 m; S6 n(2); int i; @@ -200,7 +200,7 @@ int main(int argc, char **argv) { #pragma omp parallel for simd safelen(5) for (i = 0; i < argc; ++i) foo(); -#pragma omp parallel for simd firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp parallel for simd firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} for (i = 0; i < argc; ++i) foo(); #pragma omp parallel for simd firstprivate(m) // OK @@ -221,7 +221,7 @@ int main(int argc, char **argv) { #pragma omp parallel for simd firstprivate(j) // expected-error {{arguments of OpenMP clause 'firstprivate' cannot be of reference type}} for (i = 0; i < argc; ++i) foo(); -#pragma omp parallel for simd lastprivate(g) firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp parallel for simd lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}} for (i = 0; i < argc; ++i) foo(); #pragma omp parallel for simd lastprivate(n) firstprivate(n) // OK diff --git a/clang/test/OpenMP/parallel_sections_firstprivate_messages.cpp b/clang/test/OpenMP/parallel_sections_firstprivate_messages.cpp index ffd2b0cfd5e..2d27b1a600d 100644 --- a/clang/test/OpenMP/parallel_sections_firstprivate_messages.cpp +++ b/clang/test/OpenMP/parallel_sections_firstprivate_messages.cpp @@ -14,7 +14,7 @@ class S2 { public: S2() : a(0) {} - S2(S2 &s2) : a(s2.a) {} + S2(const S2 &s2) : a(s2.a) {} static float S2s; static const float S2sc; }; @@ -27,22 +27,22 @@ class S3 { public: S3() : a(0) {} - S3(S3 &s3) : a(s3.a) {} + S3(const S3 &s3) : a(s3.a) {} }; const S3 c; const S3 ca[5]; extern const int f; -class S4 { // expected-note 2 {{'S4' declared here}} +class S4 { int a; S4(); - S4(const S4 &s4); + S4(const S4 &s4); // expected-note 2 {{implicitly declared private here}} public: S4(int v) : a(v) {} }; -class S5 { // expected-note 4 {{'S5' declared here}} +class S5 { int a; - S5(const S5 &s5) : a(s5.a) {} + S5(const S5 &s5) : a(s5.a) {} // expected-note 4 {{implicitly declared private here}} public: S5() : a(0) {} @@ -62,8 +62,8 @@ S3 h; template <class I, class C> int foomain(int argc, char **argv) { - I e(4); // expected-note {{'e' defined here}} - C g(5); // expected-note 2 {{'g' defined here}} + I e(4); + C g(5); int i; int &j = i; // expected-note {{'j' defined here}} #pragma omp parallel sections firstprivate // expected-error {{expected '(' after 'firstprivate'}} @@ -106,7 +106,7 @@ int foomain(int argc, char **argv) { { foo(); } -#pragma omp parallel sections firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp parallel sections firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} { foo(); } @@ -138,7 +138,7 @@ int foomain(int argc, char **argv) { { foo(); } -#pragma omp parallel sections lastprivate(g) firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp parallel sections lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}} { foo(); } @@ -158,8 +158,8 @@ int foomain(int argc, char **argv) { int main(int argc, char **argv) { const int d = 5; const int da[5] = {0}; - S4 e(4); // expected-note {{'e' defined here}} - S5 g(5); // expected-note 2 {{'g' defined here}} + S4 e(4); + S5 g(5); S3 m; S6 n(2); int i; @@ -237,7 +237,7 @@ int main(int argc, char **argv) { { foo(); } -#pragma omp parallel sections firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp parallel sections firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} { foo(); } @@ -262,7 +262,7 @@ int main(int argc, char **argv) { { foo(); } -#pragma omp parallel sections lastprivate(g) firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp parallel sections lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}} { foo(); } diff --git a/clang/test/OpenMP/sections_firstprivate_messages.cpp b/clang/test/OpenMP/sections_firstprivate_messages.cpp index b030ce549d3..ecee45900fe 100644 --- a/clang/test/OpenMP/sections_firstprivate_messages.cpp +++ b/clang/test/OpenMP/sections_firstprivate_messages.cpp @@ -14,7 +14,7 @@ class S2 { public: S2() : a(0) {} - S2(S2 &s2) : a(s2.a) {} + S2(const S2 &s2) : a(s2.a) {} static float S2s; static const float S2sc; }; @@ -27,22 +27,22 @@ class S3 { public: S3() : a(0) {} - S3(S3 &s3) : a(s3.a) {} + S3(const S3 &s3) : a(s3.a) {} }; const S3 c; const S3 ca[5]; extern const int f; -class S4 { // expected-note 2 {{'S4' declared here}} +class S4 { int a; S4(); - S4(const S4 &s4); + S4(const S4 &s4); // expected-note 2 {{implicitly declared private here}} public: S4(int v) : a(v) {} }; -class S5 { // expected-note 4 {{'S5' declared here}} +class S5 { int a; - S5(const S5 &s5) : a(s5.a) {} + S5(const S5 &s5) : a(s5.a) {} // expected-note 4 {{implicitly declared private here}} public: S5() : a(0) {} @@ -62,8 +62,8 @@ S3 h; template <class I, class C> int foomain(int argc, char **argv) { - I e(4); // expected-note {{'e' defined here}} - C g(5); // expected-note 2 {{'g' defined here}} + I e(4); + C g(5); int i; int &j = i; // expected-note {{'j' defined here}} #pragma omp parallel @@ -117,7 +117,7 @@ int foomain(int argc, char **argv) { foo(); } #pragma omp parallel -#pragma omp sections firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp sections firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} { foo(); } @@ -153,7 +153,7 @@ int foomain(int argc, char **argv) { foo(); } #pragma omp parallel -#pragma omp sections lastprivate(g) firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp sections lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}} { foo(); } @@ -173,8 +173,8 @@ int foomain(int argc, char **argv) { int main(int argc, char **argv) { const int d = 5; const int da[5] = {0}; - S4 e(4); // expected-note {{'e' defined here}} - S5 g(5); // expected-note 2 {{'g' defined here}} + S4 e(4); + S5 g(5); S3 m; S6 n(2); int i; @@ -271,7 +271,7 @@ int main(int argc, char **argv) { foo(); } #pragma omp parallel -#pragma omp sections firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp sections firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} { foo(); } @@ -301,7 +301,7 @@ int main(int argc, char **argv) { foo(); } #pragma omp parallel -#pragma omp sections lastprivate(g) firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp sections lastprivate(g) firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}} { foo(); } diff --git a/clang/test/OpenMP/single_firstprivate_messages.cpp b/clang/test/OpenMP/single_firstprivate_messages.cpp index 6d4988254fb..9f6f1608354 100644 --- a/clang/test/OpenMP/single_firstprivate_messages.cpp +++ b/clang/test/OpenMP/single_firstprivate_messages.cpp @@ -14,7 +14,7 @@ class S2 { public: S2() : a(0) {} - S2(S2 &s2) : a(s2.a) {} + S2(const S2 &s2) : a(s2.a) {} static float S2s; static const float S2sc; }; @@ -27,22 +27,22 @@ class S3 { public: S3() : a(0) {} - S3(S3 &s3) : a(s3.a) {} + S3(const S3 &s3) : a(s3.a) {} }; const S3 c; const S3 ca[5]; extern const int f; -class S4 { // expected-note 2 {{'S4' declared here}} +class S4 { int a; S4(); - S4(const S4 &s4); + S4(const S4 &s4); // expected-note 2 {{implicitly declared private here}} public: S4(int v) : a(v) {} }; -class S5 { // expected-note 4 {{'S5' declared here}} +class S5 { int a; - S5(const S5 &s5) : a(s5.a) {} + S5(const S5 &s5) : a(s5.a) {} // expected-note 4 {{implicitly declared private here}} public: S5() : a(0) {} @@ -62,8 +62,8 @@ S3 h; template <class I, class C> int foomain(int argc, char **argv) { - I e(4); // expected-note {{'e' defined here}} - C g(5); // expected-note 2 {{'g' defined here}} + I e(4); + C g(5); int i; int &j = i; // expected-note {{'j' defined here}} #pragma omp parallel @@ -97,7 +97,7 @@ int foomain(int argc, char **argv) { #pragma omp single firstprivate(argv[1]) // expected-error {{expected variable name}} foo(); #pragma omp parallel -#pragma omp single firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp single firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} foo(); #pragma omp parallel #pragma omp single firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} @@ -121,7 +121,7 @@ int foomain(int argc, char **argv) { #pragma omp single firstprivate(i) foo(); #pragma omp parallel -#pragma omp single firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp single firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}} foo(); #pragma omp parallel private(i) // expected-note {{defined as private}} #pragma omp single firstprivate(i) // expected-error {{firstprivate variable must be shared}} @@ -135,8 +135,8 @@ int foomain(int argc, char **argv) { int main(int argc, char **argv) { const int d = 5; const int da[5] = {0}; - S4 e(4); // expected-note {{'e' defined here}} - S5 g(5); // expected-note 2 {{'g' defined here}} + S4 e(4); + S5 g(5); S3 m; S6 n(2); int i; @@ -197,7 +197,7 @@ int main(int argc, char **argv) { #pragma omp single safelen(5) // expected-error {{unexpected OpenMP clause 'safelen' in directive '#pragma omp single'}} foo(); #pragma omp parallel -#pragma omp single firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp single firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}} foo(); #pragma omp parallel #pragma omp single firstprivate(m) // OK @@ -215,7 +215,7 @@ int main(int argc, char **argv) { #pragma omp single firstprivate(j) // expected-error {{arguments of OpenMP clause 'firstprivate' cannot be of reference type}} foo(); #pragma omp parallel -#pragma omp single firstprivate(g) // expected-error {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp single firstprivate(g) // expected-error {{calling a private constructor of class 'S5'}} foo(); #pragma omp parallel #pragma omp single firstprivate(n) // OK diff --git a/clang/test/OpenMP/task_firstprivate_messages.cpp b/clang/test/OpenMP/task_firstprivate_messages.cpp index 85d3f9f4614..6c5ccfca57b 100644 --- a/clang/test/OpenMP/task_firstprivate_messages.cpp +++ b/clang/test/OpenMP/task_firstprivate_messages.cpp @@ -14,7 +14,7 @@ class S2 { public: S2() : a(0) {} - S2(S2 &s2) : a(s2.a) {} + S2(const S2 &s2) : a(s2.a) {} static float S2s; static const float S2sc; }; @@ -26,23 +26,23 @@ class S3 { public: S3() : a(0) {} - S3(S3 &s3) : a(s3.a) {} + S3(const S3 &s3) : a(s3.a) {} }; const S3 c; const S3 ca[5]; extern const int f; -class S4 { // expected-note {{'S4' declared here}} +class S4 { int a; S4(); - S4(const S4 &s4); + S4(const S4 &s4); // expected-note 2 {{implicitly declared private here}} public: S4(int v) : a(v) {} }; -class S5 { // expected-note {{'S5' declared here}} +class S5 { int a; S5() : a(0) {} - S5(const S5 &s5) : a(s5.a) {} + S5(const S5 &s5) : a(s5.a) {} // expected-note 2 {{implicitly declared private here}} public: S5(int v) : a(v) {} @@ -54,8 +54,8 @@ S3 h; int main(int argc, char **argv) { const int d = 5; const int da[5] = {0}; - S4 e(4); // expected-note {{'e' defined here}} - S5 g(5); // expected-note {{'g' defined here}} + S4 e(4); + S5 g(5); int i; int &j = i; // expected-note {{'j' defined here}} #pragma omp task firstprivate // expected-error {{expected '(' after 'firstprivate'}} @@ -73,7 +73,7 @@ int main(int argc, char **argv) { #pragma omp task firstprivate(da) #pragma omp task firstprivate(S2::S2s) #pragma omp task firstprivate(S2::S2sc) -#pragma omp task firstprivate(e, g) // expected-error 2 {{firstprivate variable must have an accessible, unambiguous copy constructor}} +#pragma omp task firstprivate(e, g) // expected-error 2 {{calling a private constructor of class 'S4'}} expected-error 2 {{calling a private constructor of class 'S5'}} #pragma omp task firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} #pragma omp task private(i), firstprivate(i) // expected-error {{private variable cannot be firstprivate}} expected-note{{defined as private}} foo(); diff --git a/clang/test/OpenMP/task_messages.cpp b/clang/test/OpenMP/task_messages.cpp index 88c339afc11..b02b43c2b39 100644 --- a/clang/test/OpenMP/task_messages.cpp +++ b/clang/test/OpenMP/task_messages.cpp @@ -5,8 +5,8 @@ void foo() { #pragma omp task // expected-error {{unexpected OpenMP directive '#pragma omp task'}} -class S { // expected-note 6 {{'S' declared here}} - S(const S &s) { a = s.a + 12; } +class S { + S(const S &s) { a = s.a + 12; } // expected-note 6 {{implicitly declared private here}} int a; public: @@ -17,23 +17,35 @@ public: S operator+(const S &) { return *this; } }; +class S1 { + int a; + +public: + S1() : a(0) {} + S1 &operator++() { return *this; } + S1(const S1 &) = delete; // expected-note 2 {{'S1' has been explicitly marked deleted here}} +}; + template <class T> int foo() { - T a; // expected-note 3 {{'a' defined here}} + T a; T &b = a; // expected-note 4 {{'b' defined here}} int r; + S1 s1; +// expected-error@+1 2 {{call to deleted constructor of 'S1'}} +#pragma omp task +// expected-note@+1 2 {{predetermined as a firstprivate in a task construct here}} + ++s1; #pragma omp task default(none) #pragma omp task default(shared) ++a; -// expected-error@+2 {{predetermined as a firstprivate in a task construct variable must have an accessible, unambiguous copy constructor}} #pragma omp task default(none) #pragma omp task -// expected-note@+1 {{used here}} + // expected-error@+1 {{calling a private constructor of class 'S'}} ++a; #pragma omp task -// expected-error@+1 {{predetermined as a firstprivate in a task construct variable must have an accessible, unambiguous copy constructor}} #pragma omp task - // expected-note@+1 {{used here}} + // expected-error@+1 {{calling a private constructor of class 'S'}} ++a; #pragma omp task default(shared) #pragma omp task @@ -46,11 +58,11 @@ int foo() { #pragma omp task // expected-note@+1 2 {{used here}} ++b; -// expected-error@+3 {{predetermined as a firstprivate in a task construct variable cannot be of reference type 'int &'}} -// expected-error@+2 {{predetermined as a firstprivate in a task construct variable cannot be of reference type 'S &'}} -// expected-error@+1 {{predetermined as a firstprivate in a task construct variable must have an accessible, unambiguous copy constructor}} +// expected-error@+2 {{predetermined as a firstprivate in a task construct variable cannot be of reference type 'int &'}} +// expected-error@+1 {{predetermined as a firstprivate in a task construct variable cannot be of reference type 'S &'}} #pragma omp task -// expected-note@+1 3 {{used here}} +// expected-error@+2 {{calling a private constructor of class 'S'}} +// expected-note@+1 2 {{used here}} #pragma omp parallel shared(a, b) ++a, ++b; // expected-note@+1 3 {{defined as reduction}} @@ -109,7 +121,7 @@ int foo() { int main(int argc, char **argv) { int a; int &b = a; // expected-note 2 {{'b' defined here}} - S sa; // expected-note 3 {{'sa' defined here}} + S sa; S &sb = sa; // expected-note 2 {{'sb' defined here}} int r; #pragma omp task { // expected-warning {{extra tokens at the end of '#pragma omp task' are ignored}} @@ -193,14 +205,12 @@ L2: #pragma omp task default(shared) ++sa; #pragma omp task default(none) -// expected-error@+1 {{predetermined as a firstprivate in a task construct variable must have an accessible, unambiguous copy constructor}} #pragma omp task -// expected-note@+1 {{used here}} + // expected-error@+1 {{calling a private constructor of class 'S'}} ++sa; #pragma omp task -// expected-error@+1 {{predetermined as a firstprivate in a task construct variable must have an accessible, unambiguous copy constructor}} #pragma omp task -// expected-note@+1 {{used here}} + // expected-error@+1 {{calling a private constructor of class 'S'}} ++sa; #pragma omp task default(shared) #pragma omp task @@ -212,10 +222,10 @@ L2: #pragma omp task // expected-note@+1 {{used here}} ++sb; -// expected-error@+2 {{predetermined as a firstprivate in a task construct variable cannot be of reference type 'S &'}} -// expected-error@+1 {{predetermined as a firstprivate in a task construct variable must have an accessible, unambiguous copy constructor}} +// expected-error@+1 {{predetermined as a firstprivate in a task construct variable cannot be of reference type 'S &'}} #pragma omp task -// expected-note@+1 2 {{used here}} +// expected-error@+2 {{calling a private constructor of class 'S'}} +// expected-note@+1 {{used here}} #pragma omp parallel shared(sa, sb) ++sa, ++sb; // expected-note@+1 2 {{defined as reduction}} |