summaryrefslogtreecommitdiffstats
path: root/test/OpenMP/simd_lastprivate_messages.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2015-04-16 04:54:05 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2015-04-16 04:54:05 +0000
commit5a78b2480c717cbbf91747a154e3556b40ae8b76 (patch)
tree8697923cf30b28b8beb6bf705d989eb7579684cf /test/OpenMP/simd_lastprivate_messages.cpp
parentb4a4ab9bdd5e0cbb32588aee51a2c67f9a18373f (diff)
[OPENMP] Codegen for 'lastprivate' clause in 'for' directive.
#pragma omp for lastprivate(<var>) for (i = a; i < b; ++b) <BODY>; This construct is translated into something like: <last_iter> = alloca i32 <lastprivate_var> = alloca <type> <last_iter> = 0 ; No initializer for simple variables or a default constructor is called for objects. ; For arrays perform element by element initialization by the call of the default constructor. ... OMP_FOR_START(...,<last_iter>, ..); sets <last_iter> to 1 if this is the last iteration. <BODY> ... OMP_FOR_END if (<last_iter> != 0) { <var> = <lastprivate_var> ; Update original variable with the lastprivate value. } call __kmpc_cancel_barrier() ; an implicit barrier to avoid possible data race. Differential Revision: http://reviews.llvm.org/D8658 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@235074 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/OpenMP/simd_lastprivate_messages.cpp')
-rw-r--r--test/OpenMP/simd_lastprivate_messages.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/test/OpenMP/simd_lastprivate_messages.cpp b/test/OpenMP/simd_lastprivate_messages.cpp
index 55f6058350..33871813b8 100644
--- a/test/OpenMP/simd_lastprivate_messages.cpp
+++ b/test/OpenMP/simd_lastprivate_messages.cpp
@@ -15,15 +15,16 @@ class S2 {
public:
S2() : a(0) {}
S2(S2 &s2) : a(s2.a) {}
+ const S2 &operator=(const S2 &) const;
static float S2s; // expected-note {{static data member is predetermined as shared}}
static const float S2sc;
};
const float S2::S2sc = 0; // expected-note {{static data member is predetermined as shared}}
const S2 b;
const S2 ba[5];
-class S3 { // expected-note {{'S3' declared here}}
+class S3 {
int a;
- S3 &operator=(const S3 &s3);
+ S3 &operator=(const S3 &s3); // expected-note {{implicitly declared private here}}
public:
S3() : a(0) {}
@@ -32,17 +33,17 @@ public:
const S3 c; // expected-note {{global variable is predetermined as shared}}
const S3 ca[5]; // expected-note {{global variable is predetermined as shared}}
extern const int f; // expected-note {{global variable is predetermined as shared}}
-class S4 { // expected-note {{'S4' declared here}}
+class S4 {
int a;
- S4();
+ S4(); // expected-note {{implicitly declared private here}}
S4(const S4 &s4);
public:
S4(int v) : a(v) {}
};
-class S5 { // expected-note {{'S5' declared here}}
+class S5 {
int a;
- S5() : a(0) {}
+ S5() : a(0) {} // expected-note {{implicitly declared private here}}
public:
S5(const S5 &s5) : a(s5.a) {}
@@ -121,9 +122,9 @@ int foomain(I argc, C **argv) {
int main(int argc, char **argv) {
const int d = 5; // expected-note {{constant variable is predetermined as shared}}
const int da[5] = {0}; // expected-note {{constant variable is predetermined as shared}}
- S4 e(4); // expected-note {{'e' defined here}}
- S5 g(5); // expected-note {{'g' defined here}}
- S3 m; // expected-note {{'m' defined here}}
+ S4 e(4);
+ S5 g(5);
+ S3 m;
int i;
int &j = i; // expected-note {{'j' defined here}}
#pragma omp simd lastprivate // expected-error {{expected '(' after 'lastprivate'}}
@@ -181,10 +182,10 @@ int main(int argc, char **argv) {
#pragma omp simd firstprivate(g) // expected-error {{unexpected OpenMP clause 'firstprivate' in directive '#pragma omp simd'}}
for (i = 0; i < argc; ++i)
foo();
-#pragma omp simd lastprivate(e, g) // expected-error 2 {{lastprivate variable must have an accessible, unambiguous default constructor}}
+#pragma omp simd lastprivate(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 simd lastprivate(m) // expected-error {{lastprivate variable must have an accessible, unambiguous copy assignment operator}}
+#pragma omp simd lastprivate(m) // expected-error {{'operator=' is a private member of 'S3'}}
for (i = 0; i < argc; ++i)
foo();
#pragma omp simd lastprivate(h) // expected-error {{threadprivate or thread local variable cannot be lastprivate}}