r237102 - [OPENMP] Allow using of threadprivate variables as loop-control variables in lop based directives.
Alexey Bataev
a.bataev at hotmail.com
Tue May 12 02:02:12 PDT 2015
Author: abataev
Date: Tue May 12 04:02:07 2015
New Revision: 237102
URL: http://llvm.org/viewvc/llvm-project?rev=237102&view=rev
Log:
[OPENMP] Allow using of threadprivate variables as loop-control variables in lop based directives.
Modified:
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/for_loop_messages.cpp
cfe/trunk/test/OpenMP/for_simd_loop_messages.cpp
cfe/trunk/test/OpenMP/parallel_for_loop_messages.cpp
cfe/trunk/test/OpenMP/parallel_for_simd_loop_messages.cpp
cfe/trunk/test/OpenMP/simd_loop_messages.cpp
Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=237102&r1=237101&r2=237102&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Tue May 12 04:02:07 2015
@@ -2606,11 +2606,12 @@ static bool CheckOpenMPIterationSpace(
? ((NestedLoopCount == 1) ? OMPC_linear : OMPC_lastprivate)
: OMPC_private;
if (((isOpenMPSimdDirective(DKind) && DVar.CKind != OMPC_unknown &&
- DVar.CKind != PredeterminedCKind) ||
+ DVar.CKind != OMPC_threadprivate && DVar.CKind != PredeterminedCKind) ||
(isOpenMPWorksharingDirective(DKind) && !isOpenMPSimdDirective(DKind) &&
DVar.CKind != OMPC_unknown && DVar.CKind != OMPC_private &&
- DVar.CKind != OMPC_lastprivate)) &&
- (DVar.CKind != OMPC_private || DVar.RefExpr != nullptr)) {
+ DVar.CKind != OMPC_lastprivate && DVar.CKind != OMPC_threadprivate)) &&
+ ((DVar.CKind != OMPC_private && DVar.CKind != OMPC_threadprivate) ||
+ DVar.RefExpr != nullptr)) {
SemaRef.Diag(Init->getLocStart(), diag::err_omp_loop_var_dsa)
<< getOpenMPClauseName(DVar.CKind) << getOpenMPDirectiveName(DKind)
<< getOpenMPClauseName(PredeterminedCKind);
Modified: cfe/trunk/test/OpenMP/for_loop_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_loop_messages.cpp?rev=237102&r1=237101&r2=237102&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/for_loop_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/for_loop_messages.cpp Tue May 12 04:02:07 2015
@@ -10,10 +10,10 @@ public:
};
static int sii;
-#pragma omp threadprivate(sii) // expected-note {{defined as threadprivate or thread local}}
+#pragma omp threadprivate(sii)
static int globalii;
-register int reg0 __asm__("0"); // expected-note {{defined as threadprivate or thread local}}
+register int reg0 __asm__("0");
int test_iteration_spaces() {
const int N = 100;
@@ -308,7 +308,6 @@ int test_iteration_spaces() {
#pragma omp parallel
{
-// expected-error at +2 {{loop iteration variable in the associated loop of 'omp for' directive may not be threadprivate or thread local, predetermined as private}}
#pragma omp for
for (sii = 0; sii < 10; sii += 1)
c[sii] = a[sii];
@@ -316,7 +315,6 @@ int test_iteration_spaces() {
#pragma omp parallel
{
-// expected-error at +2 {{loop iteration variable in the associated loop of 'omp for' directive may not be threadprivate or thread local, predetermined as private}}
#pragma omp for
for (reg0 = 0; reg0 < 10; reg0 += 1)
c[reg0] = a[reg0];
Modified: cfe/trunk/test/OpenMP/for_simd_loop_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_simd_loop_messages.cpp?rev=237102&r1=237101&r2=237102&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/for_simd_loop_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/for_simd_loop_messages.cpp Tue May 12 04:02:07 2015
@@ -10,7 +10,7 @@ public:
};
static int sii;
-#pragma omp threadprivate(sii) // expected-note {{defined as threadprivate or thread local}}
+#pragma omp threadprivate(sii)
static int globalii;
int test_iteration_spaces() {
@@ -306,7 +306,6 @@ int test_iteration_spaces() {
#pragma omp parallel
{
-// expected-error at +2 {{loop iteration variable in the associated loop of 'omp for simd' directive may not be threadprivate or thread local, predetermined as linear}}
#pragma omp for simd
for (sii = 0; sii < 10; sii += 1)
c[sii] = a[sii];
Modified: cfe/trunk/test/OpenMP/parallel_for_loop_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_for_loop_messages.cpp?rev=237102&r1=237101&r2=237102&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_for_loop_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_for_loop_messages.cpp Tue May 12 04:02:07 2015
@@ -10,7 +10,7 @@ public:
};
static int sii;
-#pragma omp threadprivate(sii) // expected-note {{defined as threadprivate or thread local}}
+#pragma omp threadprivate(sii)
static int globalii;
int test_iteration_spaces() {
@@ -258,7 +258,6 @@ int test_iteration_spaces() {
c[ii] = a[ii];
{
-// expected-error at +2 {{loop iteration variable in the associated loop of 'omp parallel for' directive may not be threadprivate or thread local, predetermined as private}}
#pragma omp parallel for
for (sii = 0; sii < 10; sii += 1)
c[sii] = a[sii];
Modified: cfe/trunk/test/OpenMP/parallel_for_simd_loop_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_for_simd_loop_messages.cpp?rev=237102&r1=237101&r2=237102&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_for_simd_loop_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_for_simd_loop_messages.cpp Tue May 12 04:02:07 2015
@@ -10,7 +10,7 @@ public:
};
static int sii;
-#pragma omp threadprivate(sii) // expected-note {{defined as threadprivate or thread local}}
+#pragma omp threadprivate(sii)
static int globalii;
int test_iteration_spaces() {
@@ -259,7 +259,6 @@ int test_iteration_spaces() {
c[ii] = a[ii];
{
-// expected-error at +2 {{loop iteration variable in the associated loop of 'omp parallel for simd' directive may not be threadprivate or thread local, predetermined as linear}}
#pragma omp parallel for simd
for (sii = 0; sii < 10; sii += 1)
c[sii] = a[sii];
Modified: cfe/trunk/test/OpenMP/simd_loop_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/simd_loop_messages.cpp?rev=237102&r1=237101&r2=237102&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/simd_loop_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/simd_loop_messages.cpp Tue May 12 04:02:07 2015
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -fopenmp=libiomp5 -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify %s
static int sii;
-#pragma omp threadprivate(sii) // expected-note {{defined as threadprivate or thread local}}
+#pragma omp threadprivate(sii)
static int globalii;
int test_iteration_spaces() {
@@ -252,7 +252,6 @@ int test_iteration_spaces() {
#pragma omp parallel
{
- // expected-error at +2 {{loop iteration variable in the associated loop of 'omp simd' directive may not be threadprivate or thread local, predetermined as linear}}
#pragma omp simd
for (sii = 0; sii < 10; sii+=1)
c[sii] = a[sii];
More information about the cfe-commits
mailing list