r237882 - [OPENMP] Fixed codegen for parameters privatization.

Alexey Bataev a.bataev at hotmail.com
Thu May 21 02:47:47 PDT 2015


Author: abataev
Date: Thu May 21 04:47:46 2015
New Revision: 237882

URL: http://llvm.org/viewvc/llvm-project?rev=237882&view=rev
Log:
[OPENMP] Fixed codegen for parameters privatization.

For parameters we shall take a derived type of parameters, not the original one.

Modified:
    cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
    cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
    cfe/trunk/lib/Sema/SemaOpenMP.cpp
    cfe/trunk/test/OpenMP/for_firstprivate_messages.cpp
    cfe/trunk/test/OpenMP/for_lastprivate_messages.cpp
    cfe/trunk/test/OpenMP/for_private_messages.cpp
    cfe/trunk/test/OpenMP/parallel_firstprivate_codegen.cpp
    cfe/trunk/test/OpenMP/single_codegen.cpp
    cfe/trunk/test/OpenMP/single_copyprivate_messages.cpp
    cfe/trunk/test/OpenMP/task_firstprivate_codegen.cpp
    cfe/trunk/test/OpenMP/task_firstprivate_messages.cpp
    cfe/trunk/test/OpenMP/task_private_codegen.cpp
    cfe/trunk/test/OpenMP/task_private_messages.cpp

Modified: cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp?rev=237882&r1=237881&r2=237882&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp Thu May 21 04:47:46 2015
@@ -1289,9 +1289,6 @@ static llvm::Value *emitCopyprivateCopyF
         CGF.ConvertTypeForMem(C.getPointerType(SrcExprs[I]->getType())));
     auto *VD = cast<DeclRefExpr>(CopyprivateVars[I])->getDecl();
     QualType Type = VD->getType();
-    if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
-      Type = PVD->getOriginalType();
-    }
     CGF.EmitOMPCopy(CGF, Type, DestAddr, SrcAddr,
                     cast<VarDecl>(cast<DeclRefExpr>(DestExprs[I])->getDecl()),
                     cast<VarDecl>(cast<DeclRefExpr>(SrcExprs[I])->getDecl()),
@@ -1671,9 +1668,6 @@ createPrivatesRecordDecl(CodeGenModule &
     RD->startDefinition();
     for (auto &&Pair : Privates) {
       auto Type = Pair.second.Original->getType();
-      if (auto *PVD = dyn_cast<ParmVarDecl>(Pair.second.Original)) {
-        Type = PVD->getOriginalType();
-      }
       Type = Type.getNonReferenceType();
       addFieldToRecordDecl(C, RD, Type);
     }
@@ -1960,9 +1954,6 @@ void CGOpenMPRuntime::emitTaskCall(
           auto SharedRefLValue =
               CGF.EmitLValueForField(SharedsBase, SharedField);
           QualType Type = OriginalVD->getType();
-          if (auto *PVD = dyn_cast<ParmVarDecl>(OriginalVD)) {
-            Type = PVD->getOriginalType();
-          }
           if (Type->isArrayType()) {
             // Initialize firstprivate array.
             if (!isa<CXXConstructExpr>(Init) ||

Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=237882&r1=237881&r2=237882&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Thu May 21 04:47:46 2015
@@ -133,9 +133,6 @@ bool CodeGenFunction::EmitOMPFirstprivat
             (*IRef)->getType(), VK_LValue, (*IRef)->getExprLoc());
         auto *OriginalAddr = EmitLValue(&DRE).getAddress();
         QualType Type = OrigVD->getType();
-        if (auto *PVD = dyn_cast<ParmVarDecl>(OrigVD)) {
-          Type = PVD->getOriginalType();
-        }
         if (Type->isArrayType()) {
           // Emit VarDecl with copy init for arrays.
           // Get the address of the original variable captured in current
@@ -229,9 +226,6 @@ bool CodeGenFunction::EmitOMPCopyinClaus
     for (auto *AssignOp : C->assignment_ops()) {
       auto *VD = cast<VarDecl>(cast<DeclRefExpr>(*IRef)->getDecl());
       QualType Type = VD->getType();
-      if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
-        Type = PVD->getOriginalType();
-      }
       if (CopiedVars.insert(VD->getCanonicalDecl()).second) {
         // Get the address of the master variable.
         auto *MasterAddr = VD->isStaticLocal()
@@ -355,9 +349,6 @@ void CodeGenFunction::EmitOMPLastprivate
       for (auto *AssignOp : C->assignment_ops()) {
         auto *PrivateVD = cast<VarDecl>(cast<DeclRefExpr>(*IRef)->getDecl());
         QualType Type = PrivateVD->getType();
-        if (auto *PVD = dyn_cast<ParmVarDecl>(PrivateVD)) {
-          Type = PVD->getOriginalType();
-        }
         auto *CanonicalVD = PrivateVD->getCanonicalDecl();
         if (AlreadyEmittedVars.insert(CanonicalVD).second) {
           // If lastprivate variable is a loop control variable for loop-based

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=237882&r1=237881&r2=237882&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Thu May 21 04:47:46 2015
@@ -505,9 +505,6 @@ DSAStackTy::DSAVarData DSAStackTy::getTo
   }
 
   QualType Type = D->getType().getNonReferenceType().getCanonicalType();
-  if (auto *PVD = dyn_cast<ParmVarDecl>(D)) {
-    Type = PVD->getOriginalType().getNonReferenceType().getCanonicalType();
-  }
   bool IsConstant = Type.isConstant(SemaRef.getASTContext());
   Type = SemaRef.getASTContext().getBaseElementType(Type);
   // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
@@ -664,9 +661,6 @@ void Sema::EndOpenMPDSABlock(Stmt *CurDi
           }
           auto *VD = cast<VarDecl>(cast<DeclRefExpr>(DE)->getDecl());
           QualType Type = VD->getType();
-          if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
-            Type = PVD->getOriginalType();
-          }
           auto DVar = DSAStack->getTopDSA(VD, false);
           if (DVar.CKind == OMPC_lastprivate) {
             // Generate helper private variable and initialize it with the
@@ -4761,9 +4755,6 @@ OMPClause *Sema::ActOnOpenMPPrivateClaus
     VarDecl *VD = cast<VarDecl>(D);
 
     QualType Type = VD->getType();
-    if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
-      Type = PVD->getOriginalType();
-    }
     if (Type->isDependentType() || Type->isInstantiationDependentType()) {
       // It will be analyzed later.
       Vars.push_back(DE);
@@ -4805,7 +4796,7 @@ OMPClause *Sema::ActOnOpenMPPrivateClaus
     }
 
     // Variably modified types are not supported for tasks.
-    if (Type->isVariablyModifiedType() &&
+    if (!Type->isAnyPointerType() && Type->isVariablyModifiedType() &&
         DSAStack->getCurrentDirective() == OMPD_task) {
       Diag(ELoc, diag::err_omp_variably_modified_type_not_supported)
           << getOpenMPClauseName(OMPC_private) << Type
@@ -4907,9 +4898,6 @@ OMPClause *Sema::ActOnOpenMPFirstprivate
     VarDecl *VD = cast<VarDecl>(D);
 
     QualType Type = VD->getType();
-    if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
-      Type = PVD->getOriginalType();
-    }
     if (Type->isDependentType() || Type->isInstantiationDependentType()) {
       // It will be analyzed later.
       Vars.push_back(DE);
@@ -5036,7 +5024,7 @@ OMPClause *Sema::ActOnOpenMPFirstprivate
     }
 
     // Variably modified types are not supported for tasks.
-    if (Type->isVariablyModifiedType() &&
+    if (!Type->isAnyPointerType() && Type->isVariablyModifiedType() &&
         DSAStack->getCurrentDirective() == OMPD_task) {
       Diag(ELoc, diag::err_omp_variably_modified_type_not_supported)
           << getOpenMPClauseName(OMPC_firstprivate) << Type
@@ -5143,9 +5131,6 @@ OMPClause *Sema::ActOnOpenMPLastprivateC
     VarDecl *VD = cast<VarDecl>(D);
 
     QualType Type = VD->getType();
-    if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
-      Type = PVD->getOriginalType();
-    }
     if (Type->isDependentType() || Type->isInstantiationDependentType()) {
       // It will be analyzed later.
       Vars.push_back(DE);
@@ -5280,9 +5265,6 @@ OMPClause *Sema::ActOnOpenMPSharedClause
     VarDecl *VD = cast<VarDecl>(D);
 
     QualType Type = VD->getType();
-    if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
-      Type = PVD->getOriginalType();
-    }
     if (Type->isDependentType() || Type->isInstantiationDependentType()) {
       // It will be analyzed later.
       Vars.push_back(DE);
@@ -5492,9 +5474,6 @@ OMPClause *Sema::ActOnOpenMPReductionCla
     auto D = DE->getDecl();
     auto VD = cast<VarDecl>(D);
     auto Type = VD->getType();
-    if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
-      Type = PVD->getOriginalType();
-    }
     // OpenMP [2.9.3.3, Restrictions, C/C++, p.3]
     //  A variable that appears in a private clause must not have an incomplete
     //  type or a reference type.
@@ -5825,9 +5804,6 @@ OMPClause *Sema::ActOnOpenMPLinearClause
     }
 
     QualType QType = VD->getType();
-    if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
-      QType = PVD->getOriginalType();
-    }
     if (QType->isDependentType() || QType->isInstantiationDependentType()) {
       // It will be analyzed later.
       Vars.push_back(DE);
@@ -6008,9 +5984,6 @@ OMPClause *Sema::ActOnOpenMPAlignedClaus
     // The type of list items appearing in the aligned clause must be
     // array, pointer, reference to array, or reference to pointer.
     QualType QType = VD->getType();
-    if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
-      QType = PVD->getOriginalType();
-    }
     QType = QType.getNonReferenceType().getUnqualifiedType().getCanonicalType();
     const Type *Ty = QType.getTypePtrOrNull();
     if (!Ty || (!Ty->isDependentType() && !Ty->isArrayType() &&
@@ -6090,9 +6063,6 @@ OMPClause *Sema::ActOnOpenMPCopyinClause
     VarDecl *VD = cast<VarDecl>(D);
 
     QualType Type = VD->getType();
-    if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
-      Type = PVD->getOriginalType();
-    }
     if (Type->isDependentType() || Type->isInstantiationDependentType()) {
       // It will be analyzed later.
       Vars.push_back(DE);
@@ -6183,9 +6153,6 @@ OMPClause *Sema::ActOnOpenMPCopyprivateC
     VarDecl *VD = cast<VarDecl>(D);
 
     QualType Type = VD->getType();
-    if (auto *PVD = dyn_cast<ParmVarDecl>(VD)) {
-      Type = PVD->getOriginalType();
-    }
     if (Type->isDependentType() || Type->isInstantiationDependentType()) {
       // It will be analyzed later.
       Vars.push_back(DE);
@@ -6225,7 +6192,7 @@ OMPClause *Sema::ActOnOpenMPCopyprivateC
     }
 
     // Variably modified types are not supported.
-    if (Type->isVariablyModifiedType()) {
+    if (!Type->isAnyPointerType() && Type->isVariablyModifiedType()) {
       Diag(ELoc, diag::err_omp_variably_modified_type_not_supported)
           << getOpenMPClauseName(OMPC_copyprivate) << Type
           << getOpenMPDirectiveName(DSAStack->getCurrentDirective());

Modified: cfe/trunk/test/OpenMP/for_firstprivate_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_firstprivate_messages.cpp?rev=237882&r1=237881&r2=237882&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/for_firstprivate_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/for_firstprivate_messages.cpp Thu May 21 04:47:46 2015
@@ -35,7 +35,7 @@ extern const int f;
 class S4 {
   int a;
   S4();
-  S4(const S4 &s4); // expected-note 3 {{implicitly declared private here}}
+  S4(const S4 &s4); // expected-note 2 {{implicitly declared private here}}
 
 public:
   S4(int v) : a(v) {}
@@ -154,7 +154,7 @@ int foomain(int argc, char **argv) {
 
 void bar(S4 a[2]) {
 #pragma omp parallel
-#pragma omp for firstprivate(a) // expected-error {{calling a private constructor of class 'S4'}}
+#pragma omp for firstprivate(a)
   for (int i = 0; i < 2; ++i)
     foo();
 }

Modified: cfe/trunk/test/OpenMP/for_lastprivate_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_lastprivate_messages.cpp?rev=237882&r1=237881&r2=237882&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/for_lastprivate_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/for_lastprivate_messages.cpp Thu May 21 04:47:46 2015
@@ -36,7 +36,7 @@ const S3 ca[5];     // expected-note {{g
 extern const int f; // expected-note {{global variable is predetermined as shared}}
 class S4 {
   int a;
-  S4();             // expected-note 4 {{implicitly declared private here}}
+  S4();             // expected-note 3 {{implicitly declared private here}}
   S4(const S4 &s4);
 
 public:
@@ -144,7 +144,7 @@ int foomain(int argc, char **argv) {
 
 void bar(S4 a[2]) {
 #pragma omp parallel
-#pragma omp for lastprivate(a) // expected-error {{calling a private constructor of class 'S4'}}
+#pragma omp for lastprivate(a)
   for (int i = 0; i < 2; ++i)
     foo();
 }

Modified: cfe/trunk/test/OpenMP/for_private_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_private_messages.cpp?rev=237882&r1=237881&r2=237882&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/for_private_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/for_private_messages.cpp Thu May 21 04:47:46 2015
@@ -26,7 +26,7 @@ public:
 const S3 ca[5];
 class S4 {
   int a;
-  S4(); // expected-note 2 {{implicitly declared private here}}
+  S4(); // expected-note {{implicitly declared private here}}
 
 public:
   S4(int v) : a(v) {}
@@ -110,7 +110,7 @@ int foomain(I argc, C **argv) {
 
 void bar(S4 a[2]) {
 #pragma omp parallel
-#pragma omp for private(a) // expected-error {{calling a private constructor of class 'S4'}}
+#pragma omp for private(a)
   for (int i = 0; i < 2; ++i)
     foo();
 }

Modified: cfe/trunk/test/OpenMP/parallel_firstprivate_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_firstprivate_codegen.cpp?rev=237882&r1=237881&r2=237882&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_firstprivate_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_firstprivate_codegen.cpp Thu May 21 04:47:46 2015
@@ -250,19 +250,19 @@ struct St {
   ~St() {}
 };
 
-void array_func(int a[3], St s[2], int n, long double vla1[n]) {
+void array_func(float a[3], St s[2], int n, long double vla1[n]) {
   double vla2[n];
 // ARRAY: @__kmpc_fork_call(
-// ARRAY: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %{{.+}}, i8* %{{.+}}, i64 12, i32 4, i1 false)
-// ARRAY: call void @_ZN2StC1ERKS_(%struct.St* %{{.+}}, %struct.St* dereferenceable(8) %{{.+}}
+// ARRAY: [[PRIV_A:%.+]] = alloca float*
+// ARRAY: [[PRIV_S:%.+]] = alloca %struct.St*
+// ARRAY: [[PRIV_VLA1:%.+]] = alloca x86_fp80*
+// ARRAY: store float* %{{.+}}, float** [[PRIV_A]],
+// ARRAY: store %struct.St* %{{.+}}, %struct.St** [[PRIV_S]],
+// ARRAY: store x86_fp80* %{{.+}}, x86_fp80** [[PRIV_VLA1]],
 // ARRAY: call i8* @llvm.stacksave()
-// ARRAY: [[SIZE:%.+]] = mul nuw i64 %{{.+}}, 16
-// ARRAY: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %{{.+}}, i8* %{{.+}}, i64 [[SIZE]], i32 16, i1 false)
 // ARRAY: [[SIZE:%.+]] = mul nuw i64 %{{.+}}, 8
 // ARRAY: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %{{.+}}, i8* %{{.+}}, i64 [[SIZE]], i32 8, i1 false)
 // ARRAY: call void @llvm.stackrestore(i8*
-// ARRAY: call void @_ZN2StD1Ev(%struct.St* %{{.+}})
-// ARRAY: br i1
 #pragma omp parallel firstprivate(a, s, vla1, vla2)
   ;
 }

Modified: cfe/trunk/test/OpenMP/single_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/single_codegen.cpp?rev=237882&r1=237881&r2=237882&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/single_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/single_codegen.cpp Thu May 21 04:47:46 2015
@@ -178,12 +178,12 @@ struct St {
   ~St() {}
 };
 
-void array_func(int a[3], St s[2]) {
+void array_func(int n, int a[n], St s[2]) {
 // ARRAY: call void @__kmpc_copyprivate(%ident_t* @{{.+}}, i32 %{{.+}}, i64 16, i8* %{{.+}}, void (i8*, i8*)* [[CPY:@.+]], i32 %{{.+}})
 #pragma omp single copyprivate(a, s)
   ;
 }
 // ARRAY: define internal void [[CPY]]
-// ARRAY: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %{{.+}}, i8* %{{.+}}, i64 12, i32 4, i1 false)
-// ARRAY: call dereferenceable(8) %struct.St* @_ZN2StaSERKS_(%struct.St* %{{.+}}, %struct.St* dereferenceable(8) %{{.+}})
+// ARRAY: store i32* %{{.+}}, i32** %{{.+}},
+// ARRAY: store %struct.St* %{{.+}}, %struct.St** %{{.+}},
 #endif

Modified: cfe/trunk/test/OpenMP/single_copyprivate_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/single_copyprivate_messages.cpp?rev=237882&r1=237881&r2=237882&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/single_copyprivate_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/single_copyprivate_messages.cpp Thu May 21 04:47:46 2015
@@ -21,7 +21,7 @@ public:
 class S4 {
   int a;
   S4();
-  S4 &operator=(const S4 &s4); // expected-note 4 {{implicitly declared private here}}
+  S4 &operator=(const S4 &s4); // expected-note 3 {{implicitly declared private here}}
 
 public:
   S4(int v) : a(v) {}
@@ -105,8 +105,8 @@ T tmain(T argc, C **argv) {
   return T();
 }
 
-void bar(S4 a[2], int n, int b[n]) { // expected-note {{'b' defined here}}
-#pragma omp single copyprivate(a, b) // expected-error {{'operator=' is a private member of 'S4'}} expected-error {{arguments of OpenMP clause 'copyprivate' in '#pragma omp single' directive cannot be of variably-modified type 'int [n]'}}
+void bar(S4 a[2], int n, int b[n]) {
+#pragma omp single copyprivate(a, b)
     foo();
 }
 

Modified: cfe/trunk/test/OpenMP/task_firstprivate_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/task_firstprivate_codegen.cpp?rev=237882&r1=237881&r2=237882&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/task_firstprivate_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/task_firstprivate_codegen.cpp Thu May 21 04:47:46 2015
@@ -408,15 +408,11 @@ struct St {
   ~St() {}
 };
 
-void array_func(int a[3], St s[2]) {
+void array_func(int n, float a[n], St s[2]) {
 // ARRAY: call i8* @__kmpc_omp_task_alloc(
-// ARRAY: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %{{.+}}, i8* %{{.+}}, i64 12, i32 4, i1 false)
-// ARRAY: call void @_ZN2StC1ERKS_(%struct.St* %{{.+}}, %struct.St* dereferenceable(8) %{{.+}})
-// ARRAY: store i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[DESTRUCTORS:@.+]] to i32 (i32, i8*)*), i32 (i32, i8*)** %{{.+}},
+// ARRAY: store float** %{{.+}}, float*** %{{.+}},
+// ARRAY: store %struct.St** %{{.+}}, %struct.St*** %{{.+}},
 // ARRAY: call i32 @__kmpc_omp_task(
-// ARRAY: define internal i32 [[DESTRUCTORS]](i32,
-// ARRAY: call void @_ZN2StD1Ev(%struct.St* %{{.+}})
-// ARRAY: br i1
 #pragma omp task firstprivate(a, s)
   ;
 }

Modified: cfe/trunk/test/OpenMP/task_firstprivate_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/task_firstprivate_messages.cpp?rev=237882&r1=237881&r2=237882&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/task_firstprivate_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/task_firstprivate_messages.cpp Thu May 21 04:47:46 2015
@@ -51,8 +51,8 @@ public:
 S3 h;
 #pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
 
-void bar(int n, int b[n]) { // expected-note {{'b' defined here}}
-#pragma omp task firstprivate(b) // expected-error {{arguments of OpenMP clause 'firstprivate' in '#pragma omp task' directive cannot be of variably-modified type 'int [n]'}}
+void bar(int n, int b[n]) {
+#pragma omp task firstprivate(b)
     foo();
 }
 

Modified: cfe/trunk/test/OpenMP/task_private_codegen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/task_private_codegen.cpp?rev=237882&r1=237881&r2=237882&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/task_private_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/task_private_codegen.cpp Thu May 21 04:47:46 2015
@@ -371,15 +371,11 @@ struct St {
   ~St() {}
 };
 
-void array_func(int a[2], St s[2]) {
+void array_func(int n, float a[n], St s[2]) {
 // ARRAY: call i8* @__kmpc_omp_task_alloc(
-// ARRAY-NOT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* %{{.+}}, i8* %{{.+}}, i64 12, i32 4, i1 false)
-// ARRAY: call void @_ZN2StC1Ev(%struct.St* %{{.+}})
-// ARRAY: store i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[DESTRUCTORS:@.+]] to i32 (i32, i8*)*), i32 (i32, i8*)** %{{.+}},
+// ARRAY: store float** %{{.+}}, float*** %{{.+}},
+// ARRAY: store %struct.St** %{{.+}}, %struct.St*** %{{.+}},
 // ARRAY: call i32 @__kmpc_omp_task(
-// ARRAY: define internal i32 [[DESTRUCTORS]](i32,
-// ARRAY: call void @_ZN2StD1Ev(%struct.St* %{{.+}})
-// ARRAY: br i1
 #pragma omp task private(a, s)
   ;
 }

Modified: cfe/trunk/test/OpenMP/task_private_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/task_private_messages.cpp?rev=237882&r1=237881&r2=237882&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/task_private_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/task_private_messages.cpp Thu May 21 04:47:46 2015
@@ -45,8 +45,8 @@ public:
 int threadvar;
 #pragma omp threadprivate(threadvar) // expected-note {{defined as threadprivate or thread local}}
 
-void bar(int n, int b[n]) { // expected-note {{'b' defined here}}
-#pragma omp task private(b) // expected-error {{arguments of OpenMP clause 'private' in '#pragma omp task' directive cannot be of variably-modified type 'int [n]'}}
+void bar(int n, int b[n]) {
+#pragma omp task private(b)
     foo();
 }
 





More information about the cfe-commits mailing list