summaryrefslogtreecommitdiffstats
path: root/clang/test/OpenMP/single_firstprivate_messages.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2014-10-08 11:35:04 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2014-10-08 11:35:04 +0000
commit3854f63aaf9f4a395555260e15ae67dd612ee7e7 (patch)
treec41af1ff7a87d98f15b39f9674453279a1510bf7 /clang/test/OpenMP/single_firstprivate_messages.cpp
parentbdef50e1adc316742bc1fd6d931c4841e9838b5c (diff)
downloadbcm5719-llvm-3854f63aaf9f4a395555260e15ae67dd612ee7e7.tar.gz
bcm5719-llvm-3854f63aaf9f4a395555260e15ae67dd612ee7e7.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: 219297
Diffstat (limited to 'clang/test/OpenMP/single_firstprivate_messages.cpp')
-rw-r--r--clang/test/OpenMP/single_firstprivate_messages.cpp28
1 files changed, 14 insertions, 14 deletions
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
OpenPOWER on IntegriCloud