[clang] 086b653 - [OpenMP] atomic compare fail : Parser & AST support

2023-11-07 Thread Chi Chun Chen via cfe-commits

Author: Sunil Kuravinakop
Date: 2023-11-07T16:57:50-06:00
New Revision: 086b65340cca2648a2a91a0a47d28c7d9bafd1e5

URL: 
https://github.com/llvm/llvm-project/commit/086b65340cca2648a2a91a0a47d28c7d9bafd1e5
DIFF: 
https://github.com/llvm/llvm-project/commit/086b65340cca2648a2a91a0a47d28c7d9bafd1e5.diff

LOG: [OpenMP] atomic compare fail : Parser & AST support

This is a support for " #pragma omp atomic compare fail ". It has Parser & AST 
support for now.

Reviewed By: tianshilei1992, ABataev

Differential Revision: https://reviews.llvm.org/D123235

Added: 


Modified: 
clang/include/clang/AST/OpenMPClause.h
clang/include/clang/AST/RecursiveASTVisitor.h
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Basic/OpenMPKinds.def
clang/include/clang/Sema/Sema.h
clang/lib/AST/OpenMPClause.cpp
clang/lib/AST/StmtProfile.cpp
clang/lib/Basic/OpenMPKinds.cpp
clang/lib/CodeGen/CGStmtOpenMP.cpp
clang/lib/Parse/ParseOpenMP.cpp
clang/lib/Sema/SemaOpenMP.cpp
clang/lib/Sema/TreeTransform.h
clang/lib/Serialization/ASTReader.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/test/OpenMP/atomic_ast_print.cpp
clang/test/OpenMP/atomic_messages.cpp
clang/tools/libclang/CIndex.cpp
flang/lib/Semantics/check-omp-structure.cpp
llvm/include/llvm/Frontend/OpenMP/OMP.td

Removed: 




diff  --git a/clang/include/clang/AST/OpenMPClause.h 
b/clang/include/clang/AST/OpenMPClause.h
index 549f12e87df597a..f7ecffe6154af80 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -2513,6 +2513,104 @@ class OMPRelaxedClause final : public OMPClause {
   }
 };
 
+/// This represents 'fail' clause in the '#pragma omp atomic'
+/// directive.
+///
+/// \code
+/// #pragma omp atomic compare fail
+/// \endcode
+/// In this example directive '#pragma omp atomic compare' has 'fail' clause.
+class OMPFailClause final : public OMPClause {
+
+  // FailParameter is a memory-order-clause. Storing the ClauseKind is
+  // sufficient for our purpose.
+  OpenMPClauseKind FailParameter = llvm::omp::Clause::OMPC_unknown;
+  SourceLocation FailParameterLoc;
+  SourceLocation LParenLoc;
+
+  friend class OMPClauseReader;
+
+  /// Sets the location of '(' in fail clause.
+  void setLParenLoc(SourceLocation Loc) {
+LParenLoc = Loc;
+  }
+
+  /// Sets the location of memoryOrder clause argument in fail clause.
+  void setFailParameterLoc(SourceLocation Loc) { FailParameterLoc = Loc; }
+
+  /// Sets the mem_order clause for 'atomic compare fail' directive.
+  void setFailParameter(OpenMPClauseKind FailParameter) {
+switch (FailParameter) {
+case llvm::omp::OMPC_acq_rel:
+case llvm::omp::OMPC_acquire:
+  this->FailParameter = llvm::omp::OMPC_acquire;
+  break;
+case llvm::omp::OMPC_relaxed:
+case llvm::omp::OMPC_release:
+  this->FailParameter = llvm::omp::OMPC_relaxed;
+  break;
+case llvm::omp::OMPC_seq_cst:
+  this->FailParameter = llvm::omp::OMPC_seq_cst;
+  break;
+default:
+  this->FailParameter = llvm::omp::OMPC_unknown;
+  break;
+}
+  }
+
+public:
+  /// Build 'fail' clause.
+  ///
+  /// \param StartLoc Starting location of the clause.
+  /// \param EndLoc Ending location of the clause.
+  OMPFailClause(SourceLocation StartLoc, SourceLocation EndLoc)
+  : OMPClause(llvm::omp::OMPC_fail, StartLoc, EndLoc) {}
+
+  OMPFailClause(OpenMPClauseKind FailParameter, SourceLocation 
FailParameterLoc,
+SourceLocation StartLoc, SourceLocation LParenLoc,
+SourceLocation EndLoc)
+  : OMPClause(llvm::omp::OMPC_fail, StartLoc, EndLoc),
+FailParameterLoc(FailParameterLoc), LParenLoc(LParenLoc) {
+
+setFailParameter(FailParameter);
+  }
+
+  /// Build an empty clause.
+  OMPFailClause()
+  : OMPClause(llvm::omp::OMPC_fail, SourceLocation(), SourceLocation()) {}
+
+  child_range children() {
+return child_range(child_iterator(), child_iterator());
+  }
+
+  const_child_range children() const {
+return const_child_range(const_child_iterator(), const_child_iterator());
+  }
+
+  child_range used_children() {
+return child_range(child_iterator(), child_iterator());
+  }
+  const_child_range used_children() const {
+return const_child_range(const_child_iterator(), const_child_iterator());
+  }
+
+  static bool classof(const OMPClause *T) {
+return T->getClauseKind() == llvm::omp::OMPC_fail;
+  }
+
+  /// Gets the location of '(' (for the parameter) in fail clause.
+  SourceLocation getLParenLoc() const {
+return LParenLoc;
+  }
+
+  /// Gets the location of Fail Parameter (type memory-order-clause) in
+  /// fail clause.
+  SourceLocation getFailParameterLoc() const { return FailParameterLoc; }
+
+  /// Gets the parameter (type memory-order-clause) in Fail clause.
+  OpenMPClauseKind getFailParameter() const { return Fai

[clang] 8322fe2 - Adding support for target in_reduction

2022-06-27 Thread Chi Chun Chen via cfe-commits

Author: Ritanya B Bharadwaj
Date: 2022-06-27T10:36:46-05:00
New Revision: 8322fe200d60919bcf19700138f04f9fdc909360

URL: 
https://github.com/llvm/llvm-project/commit/8322fe200d60919bcf19700138f04f9fdc909360
DIFF: 
https://github.com/llvm/llvm-project/commit/8322fe200d60919bcf19700138f04f9fdc909360.diff

LOG: Adding support for target in_reduction

Implementing target in_reduction by wrapping target task with host task with 
in_reduction and if clause. This is in compliance with OpenMP 5.0 section: 
2.19.5.6.
So, this

```
  for (int i=0; ihttps://reviews.llvm.org/D125669

Added: 
clang/test/OpenMP/target_in_reduction_codegen.cpp

Modified: 
clang/lib/CodeGen/CGOpenMPRuntime.cpp
clang/lib/CodeGen/CGStmtOpenMP.cpp
clang/lib/CodeGen/CodeGenFunction.h
clang/lib/Sema/SemaOpenMP.cpp
llvm/include/llvm/Frontend/OpenMP/OMP.td

Removed: 




diff  --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp 
b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index d3e6ebb32448f..305040b01c088 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -10233,7 +10233,8 @@ void CGOpenMPRuntime::emitTargetCall(
   assert((OffloadingMandatory || OutlinedFn) && "Invalid outlined function!");
 
   const bool RequiresOuterTask = D.hasClausesOfKind() ||
- D.hasClausesOfKind();
+ D.hasClausesOfKind() ||
+ D.hasClausesOfKind();
   llvm::SmallVector CapturedVars;
   const CapturedStmt &CS = *D.getCapturedStmt(OMPD_target);
   auto &&ArgsCodegen = [&CS, &CapturedVars](CodeGenFunction &CGF,

diff  --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp 
b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index 515d365b9ee2a..301f5278df69f 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -4945,6 +4945,17 @@ void CodeGenFunction::EmitOMPTargetTaskBasedDirective(
   ++IElemInitRef;
 }
   }
+  SmallVector LHSs;
+  SmallVector RHSs;
+  for (const auto *C : S.getClausesOfKind()) {
+Data.ReductionVars.append(C->varlist_begin(), C->varlist_end());
+Data.ReductionOrigs.append(C->varlist_begin(), C->varlist_end());
+Data.ReductionCopies.append(C->privates().begin(), C->privates().end());
+Data.ReductionOps.append(C->reduction_ops().begin(),
+ C->reduction_ops().end());
+LHSs.append(C->lhs_exprs().begin(), C->lhs_exprs().end());
+RHSs.append(C->rhs_exprs().begin(), C->rhs_exprs().end());
+  }
   OMPPrivateScope TargetScope(*this);
   VarDecl *BPVD = nullptr;
   VarDecl *PVD = nullptr;
@@ -5020,8 +5031,7 @@ void CodeGenFunction::EmitOMPTargetTaskBasedDirective(
 Scope.addPrivate(Pair.first, Replacement);
   }
 }
-// Privatize all private variables except for in_reduction items.
-(void)Scope.Privatize();
+CGF.processInReduction(S, Data, CGF, CS, Scope);
 if (InputInfo.NumberOfTargetItems > 0) {
   InputInfo.BasePointersArray = CGF.Builder.CreateConstArrayGEP(
   CGF.GetAddrOfLocalVar(BPVD), /*Index=*/0);
@@ -5046,11 +5056,97 @@ void CodeGenFunction::EmitOMPTargetTaskBasedDirective(
   IntegerLiteral IfCond(getContext(), TrueOrFalse,
 getContext().getIntTypeForBitwidth(32, /*Signed=*/0),
 SourceLocation());
-
   CGM.getOpenMPRuntime().emitTaskCall(*this, S.getBeginLoc(), S, OutlinedFn,
   SharedsTy, CapturedStruct, &IfCond, 
Data);
 }
 
+void CodeGenFunction::processInReduction(const OMPExecutableDirective &S,
+ OMPTaskDataTy &Data,
+ CodeGenFunction &CGF,
+ const CapturedStmt *CS,
+ OMPPrivateScope &Scope) {
+  if (Data.Reductions) {
+OpenMPDirectiveKind CapturedRegion = S.getDirectiveKind();
+OMPLexicalScope LexScope(CGF, S, CapturedRegion);
+ReductionCodeGen RedCG(Data.ReductionVars, Data.ReductionVars,
+   Data.ReductionCopies, Data.ReductionOps);
+llvm::Value *ReductionsPtr = CGF.Builder.CreateLoad(
+CGF.GetAddrOfLocalVar(CS->getCapturedDecl()->getParam(4)));
+for (unsigned Cnt = 0, E = Data.ReductionVars.size(); Cnt < E; ++Cnt) {
+  RedCG.emitSharedOrigLValue(CGF, Cnt);
+  RedCG.emitAggregateType(CGF, Cnt);
+  // FIXME: This must removed once the runtime library is fixed.
+  // Emit required threadprivate variables for
+  // initializer/combiner/finalizer.
+  CGF.CGM.getOpenMPRuntime().emitTaskReductionFixups(CGF, S.getBeginLoc(),
+ RedCG, Cnt);
+  Address Replacement = CGF.CGM.getOpenMPRuntime().getTaskReductionItem(
+  CGF, S.getBeginLoc(), ReductionsPtr, RedCG.getSharedLValue(Cnt));
+  Replacement =
+  Address(

[clang] 92fd2eb - [Clang][OpenMP] Claim nowait clause on taskwait

2022-06-27 Thread Chi Chun Chen via cfe-commits

Author: Chi Chun Chen
Date: 2022-06-27T11:02:39-05:00
New Revision: 92fd2eb74f5b9cc3c0b4ce6c7de3c2866fa40b3a

URL: 
https://github.com/llvm/llvm-project/commit/92fd2eb74f5b9cc3c0b4ce6c7de3c2866fa40b3a
DIFF: 
https://github.com/llvm/llvm-project/commit/92fd2eb74f5b9cc3c0b4ce6c7de3c2866fa40b3a.diff

LOG: [Clang][OpenMP] Claim nowait clause on taskwait

Added: 


Modified: 
clang/docs/OpenMPSupport.rst

Removed: 




diff  --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index 1f233e63815fa..0f306be72ba0f 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -356,7 +356,7 @@ want to help with the implementation.
 
+--+--+--+---+
 | task extension   | inoutset in depend clause 
   | :none:`unclaimed`| 
  |
 
+--+--+--+---+
-| task extension   | nowait clause on taskwait 
   | :none:`unclaimed`| 
  |
+| task extension   | nowait clause on taskwait 
   | :part:`worked on`| 
  |
 
+--+--+--+---+
 
 OpenMP Extensions



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 6c3990a - [OpenMP][NFC] Claim order clause modifiers (reproducible and unconstrained)

2022-07-07 Thread Chi Chun Chen via cfe-commits

Author: Chi Chun Chen
Date: 2022-07-07T11:30:03-05:00
New Revision: 6c3990acfbb933a61e2c74332bb252121c06bd14

URL: 
https://github.com/llvm/llvm-project/commit/6c3990acfbb933a61e2c74332bb252121c06bd14
DIFF: 
https://github.com/llvm/llvm-project/commit/6c3990acfbb933a61e2c74332bb252121c06bd14.diff

LOG: [OpenMP][NFC] Claim order clause modifiers (reproducible and unconstrained)

Added: 


Modified: 
clang/docs/OpenMPSupport.rst

Removed: 




diff  --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index 336d8e597522a..c94bc0b0de362 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -302,7 +302,7 @@ want to help with the implementation.
 
+--+--+--+---+
 | loop | Loop unrolling transformation 
   | :good:`done` | D99459  
  |
 
+--+--+--+---+
-| loop | 'reproducible'/'unconstrained' modifiers in 
'order' clause   | :none:`unclaimed`|   
|
+| loop | 'reproducible'/'unconstrained' modifiers in 
'order' clause   | :part:`partial`  | D127855   
|
 
+--+--+--+---+
 | memory management| alignment for allocate directive and clause   
   | :part:`worked on`| 
  |
 
+--+--+--+---+



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] ccc12a2 - [OpenMP][NFC] Claim iterators in 'map' clause and motion clauses

2022-07-21 Thread Chi Chun Chen via cfe-commits

Author: Chi Chun Chen
Date: 2022-07-21T15:50:22-05:00
New Revision: ccc12a2376105d28b6acce59b4319df2051a0833

URL: 
https://github.com/llvm/llvm-project/commit/ccc12a2376105d28b6acce59b4319df2051a0833
DIFF: 
https://github.com/llvm/llvm-project/commit/ccc12a2376105d28b6acce59b4319df2051a0833.diff

LOG: [OpenMP][NFC] Claim iterators in 'map' clause and motion clauses

Added: 


Modified: 
clang/docs/OpenMPSupport.rst

Removed: 




diff  --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index efabe927d6df..af405d2202a8 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -291,7 +291,7 @@ implementation.
 
+--+--+--+---+
 | device   | has_device_addr clause on target construct
   | :none:`unclaimed`| 
  |
 
+--+--+--+---+
-| device   | iterators in map clause or motion clauses 
   | :none:`unclaimed`| 
  |
+| device   | iterators in map clause or motion clauses 
   | :part:`worked on`| 
  |
 
+--+--+--+---+
 | device   | indirect clause on declare target directive   
   | :none:`unclaimed`| 
  |
 
+--+--+--+---+



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 3911810 - Revert "[OpenMP] Patch for Support to loop bind clause : Checking Parent Region"

2023-10-26 Thread Chi Chun Chen via cfe-commits

Author: Chi Chun Chen
Date: 2023-10-26T16:57:36-05:00
New Revision: 391181062f8d1b9277a9068a7edf41be721ca5cf

URL: 
https://github.com/llvm/llvm-project/commit/391181062f8d1b9277a9068a7edf41be721ca5cf
DIFF: 
https://github.com/llvm/llvm-project/commit/391181062f8d1b9277a9068a7edf41be721ca5cf.diff

LOG: Revert "[OpenMP] Patch for Support to loop bind clause : Checking Parent 
Region"

This reverts commit 85f6b2fac9a367337e43ca288c45ea783981cc16.

Added: 


Modified: 
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaOpenMP.cpp
clang/test/OpenMP/loop_bind_messages.cpp
clang/test/PCH/pragma-loop.cpp

Removed: 




diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 18ac85011aa752a..1e9752345ffd173 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -11307,7 +11307,6 @@ class Sema final {
   /// on the parameter of the bind clause. In the methods for the
   /// mapped directives, check the parameters of the lastprivate clause.
   bool checkLastPrivateForMappedDirectives(ArrayRef Clauses);
-
   /// Depending on the bind clause of OMPD_loop map the directive to new
   /// directives.
   ///1) loop bind(parallel) --> OMPD_for
@@ -11317,12 +11316,9 @@ class Sema final {
   /// rigorous semantic checking in the new mapped directives.
   bool mapLoopConstruct(llvm::SmallVector &ClausesWithoutBind,
 ArrayRef Clauses,
-OpenMPBindClauseKind &BindKind,
+OpenMPBindClauseKind BindKind,
 OpenMPDirectiveKind &Kind,
-OpenMPDirectiveKind &PrevMappedDirective,
-SourceLocation StartLoc, SourceLocation EndLoc,
-const DeclarationNameInfo &DirName,
-OpenMPDirectiveKind CancelRegion);
+OpenMPDirectiveKind &PrevMappedDirective);
 
 public:
   /// The declarator \p D defines a function in the scope \p S which is nested

diff  --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index f28e0f2693080c1..75f9e152dca9297 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -5062,18 +5062,6 @@ static bool checkNestingOfRegions(Sema &SemaRef, const 
DSAStackTy *Stack,
 CurrentRegion != OMPD_cancellation_point &&
 CurrentRegion != OMPD_cancel && CurrentRegion != OMPD_scan)
   return false;
-// Checks needed for mapping "loop" construct. Please check 
mapLoopConstruct
-// for a detailed explanation
-if (SemaRef.LangOpts.OpenMP >= 50 && CurrentRegion == OMPD_loop &&
-((BindKind == OMPC_BIND_parallel) || (BindKind == OMPC_BIND_teams)) &&
-(isOpenMPWorksharingDirective(ParentRegion) ||
- ParentRegion == OMPD_loop)) {
-  int ErrorMsgNumber = (BindKind == OMPC_BIND_parallel) ? 1 : 4;
-  SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region)
-  << true << getOpenMPDirectiveName(ParentRegion) << ErrorMsgNumber
-  << getOpenMPDirectiveName(CurrentRegion);
-  return true;
-}
 if (CurrentRegion == OMPD_cancellation_point ||
 CurrentRegion == OMPD_cancel) {
   // OpenMP [2.16, Nesting of Regions]
@@ -6126,40 +6114,35 @@ processImplicitMapsWithDefaultMappers(Sema &S, 
DSAStackTy *Stack,
 
 bool Sema::mapLoopConstruct(llvm::SmallVector &ClausesWithoutBind,
 ArrayRef Clauses,
-OpenMPBindClauseKind &BindKind,
+OpenMPBindClauseKind BindKind,
 OpenMPDirectiveKind &Kind,
-OpenMPDirectiveKind &PrevMappedDirective,
-SourceLocation StartLoc, SourceLocation EndLoc,
-const DeclarationNameInfo &DirName,
-OpenMPDirectiveKind CancelRegion) {
+OpenMPDirectiveKind &PrevMappedDirective) {
 
   bool UseClausesWithoutBind = false;
 
   // Restricting to "#pragma omp loop bind"
   if (getLangOpts().OpenMP >= 50 && Kind == OMPD_loop) {
-
-const OpenMPDirectiveKind ParentDirective = DSAStack->getParentDirective();
-
 if (BindKind == OMPC_BIND_unknown) {
   // Setting the enclosing teams or parallel construct for the loop
   // directive without bind clause.
   BindKind = OMPC_BIND_thread; // Default bind(thread) if binding is 
unknown
 
+  const OpenMPDirectiveKind ParentDirective =
+  DSAStack->getParentDirective();
   if (ParentDirective == OMPD_unknown) {
 Diag(DSAStack->getDefaultDSALocation(),
  diag::err_omp_bind_required_on_loop);
-  } else if (isOpenMPParallelDirective(ParentDirective) &&
- !isOpenMPTeamsDirective(ParentDirective)) {
+  } else if (ParentDirective == OMPD_parallel ||
+ ParentD

[clang] e9babe7 - [OpenMP] Clang Support for taskwait nowait clause

2022-12-20 Thread Chi Chun Chen via cfe-commits

Author: Sunil Kuravinakop
Date: 2022-12-20T12:13:56-06:00
New Revision: e9babe7571609c9de41d4d0dfc1bc4d2f02021d0

URL: 
https://github.com/llvm/llvm-project/commit/e9babe7571609c9de41d4d0dfc1bc4d2f02021d0
DIFF: 
https://github.com/llvm/llvm-project/commit/e9babe7571609c9de41d4d0dfc1bc4d2f02021d0.diff

LOG: [OpenMP] Clang Support for taskwait nowait clause

Support for taskwait nowait clause with placeholder for runtime changes.

Reviewed By: cchen, ABataev

Differential Revision: https://reviews.llvm.org/D131830

Added: 
clang/test/OpenMP/taskwait_depend_nowait_codegen.cpp

Modified: 
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/CodeGen/CGOpenMPRuntime.cpp
clang/lib/CodeGen/CGOpenMPRuntime.h
clang/lib/CodeGen/CGStmtOpenMP.cpp
clang/lib/Sema/SemaOpenMP.cpp
clang/test/OpenMP/target_depend_codegen.cpp
clang/test/OpenMP/target_enter_data_depend_codegen.cpp
clang/test/OpenMP/target_exit_data_depend_codegen.cpp
clang/test/OpenMP/target_parallel_depend_codegen.cpp
clang/test/OpenMP/target_parallel_for_depend_codegen.cpp
clang/test/OpenMP/target_parallel_for_simd_depend_codegen.cpp
clang/test/OpenMP/target_simd_depend_codegen.cpp
clang/test/OpenMP/target_teams_depend_codegen.cpp
clang/test/OpenMP/target_teams_distribute_depend_codegen.cpp
clang/test/OpenMP/target_teams_distribute_parallel_for_depend_codegen.cpp

clang/test/OpenMP/target_teams_distribute_parallel_for_simd_depend_codegen.cpp
clang/test/OpenMP/target_teams_distribute_simd_depend_codegen.cpp
clang/test/OpenMP/target_update_depend_codegen.cpp
clang/test/OpenMP/task_if_codegen.cpp
clang/test/OpenMP/taskwait_ast_print.cpp
clang/test/OpenMP/taskwait_depend_codegen.cpp
llvm/include/llvm/Frontend/OpenMP/OMP.td
llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
openmp/runtime/src/dllexports
openmp/runtime/src/kmp.h
openmp/runtime/src/kmp_taskdeps.cpp

Removed: 




diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index ff68514621327..60ff607a3edc6 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -10733,6 +10733,8 @@ def note_omp_nested_statement_here : Note<
   "%select{statement|directive}0 outside teams construct here">;
 def err_omp_single_copyprivate_with_nowait : Error<
   "the 'copyprivate' clause must not be used with the 'nowait' clause">;
+def err_omp_nowait_clause_without_depend: Error<
+  "directive '#pragma omp taskwait' cannot use 'nowait' clause without 
'depend' clause">;
 def note_omp_nowait_clause_here : Note<
   "'nowait' clause is here">;
 def err_omp_single_decl_in_declare_simd_variant : Error<

diff  --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp 
b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 3b62beddcaa58..573367c646fc5 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -4757,7 +4757,7 @@ void CGOpenMPRuntime::emitTaskCall(CodeGenFunction &CGF, 
SourceLocation Loc,
   Region->emitUntiedSwitch(CGF);
   };
 
-  llvm::Value *DepWaitTaskArgs[6];
+  llvm::Value *DepWaitTaskArgs[7];
   if (!Data.Dependences.empty()) {
 DepWaitTaskArgs[0] = UpLoc;
 DepWaitTaskArgs[1] = ThreadID;
@@ -4765,6 +4765,8 @@ void CGOpenMPRuntime::emitTaskCall(CodeGenFunction &CGF, 
SourceLocation Loc,
 DepWaitTaskArgs[3] = DependenciesArray.getPointer();
 DepWaitTaskArgs[4] = CGF.Builder.getInt32(0);
 DepWaitTaskArgs[5] = llvm::ConstantPointerNull::get(CGF.VoidPtrTy);
+DepWaitTaskArgs[6] =
+llvm::ConstantInt::get(CGF.Int32Ty, Data.HasNowaitClause);
   }
   auto &M = CGM.getModule();
   auto &&ElseCodeGen = [this, &M, &TaskArgs, ThreadID, NewTaskNewTaskTTy,
@@ -4776,9 +4778,9 @@ void CGOpenMPRuntime::emitTaskCall(CodeGenFunction &CGF, 
SourceLocation Loc,
 // ndeps_noalias, kmp_depend_info_t *noalias_dep_list); if dependence info
 // is specified.
 if (!Data.Dependences.empty())
-  CGF.EmitRuntimeCall(
-  OMPBuilder.getOrCreateRuntimeFunction(M, 
OMPRTL___kmpc_omp_wait_deps),
-  DepWaitTaskArgs);
+  CGF.EmitRuntimeCall(OMPBuilder.getOrCreateRuntimeFunction(
+  M, OMPRTL___kmpc_omp_taskwait_deps_51),
+  DepWaitTaskArgs);
 // Call proxy_task_entry(gtid, new_task);
 auto &&CodeGen = [TaskEntry, ThreadID, NewTaskNewTaskTTy,
   Loc](CodeGenFunction &CGF, PrePostActionTy &Action) {
@@ -5826,24 +5828,26 @@ void CGOpenMPRuntime::emitTaskwaitCall(CodeGenFunction 
&CGF, SourceLocation Loc,
 llvm::Value *NumOfElements;
 std::tie(NumOfElements, DependenciesArray) =
 emitDependClause(CGF, Data.Dependences, Loc);
-llvm::Value *DepWaitTaskArgs[6];
 if (!Data.Dependences.empty()) {
+ 

[clang] 445a2ab - [OpenMP][NFC] Unclaim iterators in 'map' clause and motion clauses

2022-11-08 Thread Chi Chun Chen via cfe-commits

Author: Chi Chun Chen
Date: 2022-11-08T11:43:07-06:00
New Revision: 445a2ab60568be0a051cc2c9d2cc174cd0ab545d

URL: 
https://github.com/llvm/llvm-project/commit/445a2ab60568be0a051cc2c9d2cc174cd0ab545d
DIFF: 
https://github.com/llvm/llvm-project/commit/445a2ab60568be0a051cc2c9d2cc174cd0ab545d.diff

LOG: [OpenMP][NFC] Unclaim iterators in 'map' clause and motion clauses

Added: 


Modified: 
clang/docs/OpenMPSupport.rst

Removed: 




diff  --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index af405d2202a85..efabe927d6df5 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -291,7 +291,7 @@ implementation.
 
+--+--+--+---+
 | device   | has_device_addr clause on target construct
   | :none:`unclaimed`| 
  |
 
+--+--+--+---+
-| device   | iterators in map clause or motion clauses 
   | :part:`worked on`| 
  |
+| device   | iterators in map clause or motion clauses 
   | :none:`unclaimed`| 
  |
 
+--+--+--+---+
 | device   | indirect clause on declare target directive   
   | :none:`unclaimed`| 
  |
 
+--+--+--+---+



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] a86b506 - [NFC] Fixing a comment and some indentations

2022-11-09 Thread Chi Chun Chen via cfe-commits

Author: sandeepkosuri
Date: 2022-11-10T01:02:12-06:00
New Revision: a86b506294bc7b9a921e3e613f49730c5780eb22

URL: 
https://github.com/llvm/llvm-project/commit/a86b506294bc7b9a921e3e613f49730c5780eb22
DIFF: 
https://github.com/llvm/llvm-project/commit/a86b506294bc7b9a921e3e613f49730c5780eb22.diff

LOG: [NFC] Fixing a comment and some indentations

Added: 


Modified: 
clang/include/clang/AST/OpenMPClause.h
clang/include/clang/Sema/Scope.h

Removed: 




diff  --git a/clang/include/clang/AST/OpenMPClause.h 
b/clang/include/clang/AST/OpenMPClause.h
index 1a4ec43705bc3..a8d2221316a5c 100644
--- a/clang/include/clang/AST/OpenMPClause.h
+++ b/clang/include/clang/AST/OpenMPClause.h
@@ -7640,7 +7640,7 @@ class OMPOrderClause final : public OMPClause {
   /// Location of '('.
   SourceLocation LParenLoc;
 
-  /// A kind of the 'default' clause.
+  /// A kind of the 'order' clause.
   OpenMPOrderClauseKind Kind = OMPC_ORDER_unknown;
 
   /// Start location of the kind in source code.

diff  --git a/clang/include/clang/Sema/Scope.h 
b/clang/include/clang/Sema/Scope.h
index d2acf253552dc..deb011892b850 100644
--- a/clang/include/clang/Sema/Scope.h
+++ b/clang/include/clang/Sema/Scope.h
@@ -44,11 +44,11 @@ class Scope {
   enum ScopeFlags {
 /// This indicates that the scope corresponds to a function, which
 /// means that labels are set here.
-FnScope   = 0x01,
+FnScope = 0x01,
 
 /// This is a while, do, switch, for, etc that can have break
 /// statements embedded into it.
-BreakScope= 0x02,
+BreakScope = 0x02,
 
 /// This is a while, do, for, which can have continue statements
 /// embedded into it.



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 6d07678 - [OpenMP][NFC] Claim thread_limit clause in target directive

2022-11-16 Thread Chi Chun Chen via cfe-commits

Author: Chi Chun Chen
Date: 2022-11-17T00:44:44-06:00
New Revision: 6d076780a8c68203e35f3bc5b9d6ec1f285d66b3

URL: 
https://github.com/llvm/llvm-project/commit/6d076780a8c68203e35f3bc5b9d6ec1f285d66b3
DIFF: 
https://github.com/llvm/llvm-project/commit/6d076780a8c68203e35f3bc5b9d6ec1f285d66b3.diff

LOG: [OpenMP][NFC] Claim thread_limit clause in target directive

Added: 


Modified: 
clang/docs/OpenMPSupport.rst

Removed: 




diff  --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index efabe927d6df..dca1486f9967 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -287,7 +287,7 @@ implementation.
 
+--+--+--+---+
 | device   | new async target memory copy routines 
   | :none:`unclaimed`| 
  |
 
+--+--+--+---+
-| device   | thread_limit clause on target construct   
   | :none:`unclaimed`| 
  |
+| device   | thread_limit clause on target construct   
   | :none:`worked on`| 
  |
 
+--+--+--+---+
 | device   | has_device_addr clause on target construct
   | :none:`unclaimed`| 
  |
 
+--+--+--+---+



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] 8ab62da - [Clang][OpenMP] Support for Code Generation of loop bind clause

2023-08-09 Thread Chi Chun Chen via cfe-commits

Author: Chi Chun Chen
Date: 2023-08-09T14:26:38-05:00
New Revision: 8ab62da18d47fa0ce6aef9da50cca34a26ea775c

URL: 
https://github.com/llvm/llvm-project/commit/8ab62da18d47fa0ce6aef9da50cca34a26ea775c
DIFF: 
https://github.com/llvm/llvm-project/commit/8ab62da18d47fa0ce6aef9da50cca34a26ea775c.diff

LOG: [Clang][OpenMP] Support for Code Generation of loop bind clause

Support for Code Generation of "#pragma loop bind" clause.
1) bind(parallel)
2) bind(teams)
3) bind(thread)

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D144634

Added: 
clang/test/OpenMP/loop_bind_codegen.cpp
clang/test/OpenMP/loop_bind_enclosed.cpp
clang/test/OpenMP/loop_bind_messages.cpp

Modified: 
clang/include/clang/AST/StmtOpenMP.h
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/include/clang/Sema/Sema.h
clang/lib/AST/StmtOpenMP.cpp
clang/lib/Sema/SemaOpenMP.cpp
clang/lib/Sema/TreeTransform.h
clang/lib/Serialization/ASTReaderStmt.cpp
clang/lib/Serialization/ASTWriterStmt.cpp
clang/test/OpenMP/generic_loop_ast_print.cpp
clang/test/OpenMP/generic_loop_codegen.cpp
clang/test/OpenMP/nested_loop_codegen.cpp
clang/test/PCH/pragma-loop.cpp

Removed: 




diff  --git a/clang/include/clang/AST/StmtOpenMP.h 
b/clang/include/clang/AST/StmtOpenMP.h
index 2d37fdbf4ca8fb..20cd198f5f0cc5 100644
--- a/clang/include/clang/AST/StmtOpenMP.h
+++ b/clang/include/clang/AST/StmtOpenMP.h
@@ -281,6 +281,15 @@ class OMPExecutableDirective : public Stmt {
 return Data->getClauses();
   }
 
+  /// Was this directive mapped from an another directive?
+  /// e.g. 1) omp loop bind(parallel) is mapped to OMPD_for
+  ///  2) omp loop bind(teams) is mapped to OMPD_distribute
+  ///  3) omp loop bind(thread) is mapped to OMPD_simd
+  /// It was necessary to note it down in the Directive because of
+  /// clang::TreeTransform::TransformOMPExecutableDirective() pass in
+  /// the frontend.
+  OpenMPDirectiveKind PrevMappedDirective = llvm::omp::OMPD_unknown;
+
 protected:
   /// Data, associated with the directive.
   OMPChildren *Data = nullptr;
@@ -345,6 +354,10 @@ class OMPExecutableDirective : public Stmt {
 return Inst;
   }
 
+  void setMappedDirective(OpenMPDirectiveKind MappedDirective) {
+PrevMappedDirective = MappedDirective;
+  }
+
 public:
   /// Iterates over expressions/statements used in the construct.
   class used_clauses_child_iterator
@@ -598,6 +611,8 @@ class OMPExecutableDirective : public Stmt {
"Expected directive with the associated statement.");
 return Data->getRawStmt();
   }
+
+  OpenMPDirectiveKind getMappedDirective() const { return PrevMappedDirective; 
}
 };
 
 /// This represents '#pragma omp parallel' directive.
@@ -1604,7 +1619,8 @@ class OMPSimdDirective : public OMPLoopDirective {
   SourceLocation EndLoc, unsigned CollapsedNum,
   ArrayRef Clauses,
   Stmt *AssociatedStmt,
-  const HelperExprs &Exprs);
+  const HelperExprs &Exprs,
+  OpenMPDirectiveKind 
ParamPrevMappedDirective);
 
   /// Creates an empty directive with the place
   /// for \a NumClauses clauses.
@@ -1682,7 +1698,8 @@ class OMPForDirective : public OMPLoopDirective {
  SourceLocation EndLoc, unsigned CollapsedNum,
  ArrayRef Clauses,
  Stmt *AssociatedStmt, const HelperExprs 
&Exprs,
- Expr *TaskRedRef, bool HasCancel);
+ Expr *TaskRedRef, bool HasCancel,
+ OpenMPDirectiveKind ParamPrevMappedDirective);
 
   /// Creates an empty directive with the place
   /// for \a NumClauses clauses.
@@ -4406,7 +4423,8 @@ class OMPDistributeDirective : public OMPLoopDirective {
   static OMPDistributeDirective *
   Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
  unsigned CollapsedNum, ArrayRef Clauses,
- Stmt *AssociatedStmt, const HelperExprs &Exprs);
+ Stmt *AssociatedStmt, const HelperExprs &Exprs,
+ OpenMPDirectiveKind ParamPrevMappedDirective);
 
   /// Creates an empty directive with the place
   /// for \a NumClauses clauses.

diff  --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td 
b/clang/include/clang/Basic/DiagnosticSemaKinds.td
index f767dde3c55918..7e271ba166077b 100644
--- a/clang/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td
@@ -9886,6 +9886,11 @@ def err_break_not_in_loop_or_switch : Error<
 def warn_loop_ctrl_binds_to_inner : Warning<
   "'%0' is bound to current loop, GCC binds it to the enclosing loop">,
   InGroup;
+def err_omp_bind_required_on_loop : Error<

[clang] 59fdd4c - [NFC] Update OpenMP Support page for Clang/LLVM 17

2023-08-25 Thread Chi Chun Chen via cfe-commits

Author: Chi Chun Chen
Date: 2023-08-25T15:50:39-05:00
New Revision: 59fdd4c0715fe16accf61aa3ce76b9bb1350d0e9

URL: 
https://github.com/llvm/llvm-project/commit/59fdd4c0715fe16accf61aa3ce76b9bb1350d0e9
DIFF: 
https://github.com/llvm/llvm-project/commit/59fdd4c0715fe16accf61aa3ce76b9bb1350d0e9.diff

LOG: [NFC] Update OpenMP Support page for Clang/LLVM 17

Updating the status for a number of features in the OpenMP support page for 
Clang/LLVM 17.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D156894

Added: 


Modified: 
clang/docs/OpenMPSupport.rst

Removed: 




diff  --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst
index 5a5fa950adcd41..be3894389a3517 100644
--- a/clang/docs/OpenMPSupport.rst
+++ b/clang/docs/OpenMPSupport.rst
@@ -148,7 +148,7 @@ implementation.
 
+--+--+--+---+
 | task | task affinity 
   | :part:`not upstream` | 
https://github.com/jklinkenberg/openmp/tree/task-affinity |
 
+--+--+--+---+
-| task | clause: depend on the taskwait construct  
   | :part:`mostly done`  | D113540 (regular codegen only)  
  |
+| task | clause: depend on the taskwait construct  
   | :good:`done` | D113540 (regular codegen only)  
  |
 
+--+--+--+---+
 | task | depend objects and detachable tasks   
   | :good:`done` | 
  |
 
+--+--+--+---+
@@ -196,7 +196,7 @@ implementation.
 
+--+--+--+---+
 | device   | allow access to the reference count 
(omp_target_is_present)  | :good:`done` |   
|
 
+--+--+--+---+
-| device   | requires directive
   | :part:`partial`  | 
  |
+| device   | requires directive
   | :good:`done` | 
  |
 
+--+--+--+---+
 | device   | clause: unified_shared_memory 
   | :good:`done` | D52625,D52359   
  |
 
+--+--+--+---+
@@ -208,7 +208,7 @@ implementation.
 
+--+--+--+---+
 | device   | clause: dynamic_allocators
   | :part:`unclaimed parts`  | D53079  
  |
 
+--+--+--+---+
-| device   | user-defined mappers  
   | :part:`worked on`| 
D56326,D58638,D58523,D58074,D60972,D59474 |
+| device   | user-defined mappers   

[clang] e0fd86d - Revert "[OpenMP] Clang Support for taskwait nowait clause"

2022-12-09 Thread Chi Chun Chen via cfe-commits

Author: Chi Chun Chen
Date: 2022-12-09T11:06:45-06:00
New Revision: e0fd86db09a87f25df0eff6c1c755d86434dea0b

URL: 
https://github.com/llvm/llvm-project/commit/e0fd86db09a87f25df0eff6c1c755d86434dea0b
DIFF: 
https://github.com/llvm/llvm-project/commit/e0fd86db09a87f25df0eff6c1c755d86434dea0b.diff

LOG: Revert "[OpenMP] Clang Support for taskwait nowait clause"

This reverts commit 100dfe7a8ad3789a98df623482b88d9a3a02e176.

Added: 


Modified: 
clang/lib/CodeGen/CGOpenMPRuntime.cpp
clang/lib/CodeGen/CGOpenMPRuntime.h
clang/lib/CodeGen/CGStmtOpenMP.cpp
clang/test/OpenMP/target_depend_codegen.cpp
clang/test/OpenMP/target_enter_data_depend_codegen.cpp
clang/test/OpenMP/target_exit_data_depend_codegen.cpp
clang/test/OpenMP/target_parallel_depend_codegen.cpp
clang/test/OpenMP/target_parallel_for_depend_codegen.cpp
clang/test/OpenMP/target_parallel_for_simd_depend_codegen.cpp
clang/test/OpenMP/target_simd_depend_codegen.cpp
clang/test/OpenMP/target_teams_depend_codegen.cpp
clang/test/OpenMP/target_teams_distribute_depend_codegen.cpp
clang/test/OpenMP/target_teams_distribute_parallel_for_depend_codegen.cpp

clang/test/OpenMP/target_teams_distribute_parallel_for_simd_depend_codegen.cpp
clang/test/OpenMP/target_teams_distribute_simd_depend_codegen.cpp
clang/test/OpenMP/target_update_depend_codegen.cpp
clang/test/OpenMP/task_codegen.cpp
clang/test/OpenMP/task_if_codegen.cpp
clang/test/OpenMP/taskwait_ast_print.cpp
clang/test/OpenMP/taskwait_codegen.cpp
clang/test/OpenMP/taskwait_depend_codegen.cpp
llvm/include/llvm/Frontend/OpenMP/OMP.td
llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
llvm/include/llvm/Frontend/OpenMP/OMPKinds.def
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
mlir/test/Target/LLVMIR/openmp-llvm.mlir
openmp/runtime/src/dllexports
openmp/runtime/src/kmp.h
openmp/runtime/src/kmp_taskdeps.cpp
openmp/runtime/src/kmp_tasking.cpp

Removed: 
clang/test/OpenMP/taskwait_depend_nowait_codegen.cpp
clang/test/OpenMP/taskwait_nowait_codegen.cpp



diff  --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp 
b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 396075183102d..a75e31f40e074 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -4756,7 +4756,7 @@ void CGOpenMPRuntime::emitTaskCall(CodeGenFunction &CGF, 
SourceLocation Loc,
   Region->emitUntiedSwitch(CGF);
   };
 
-  llvm::Value *DepWaitTaskArgs[7];
+  llvm::Value *DepWaitTaskArgs[6];
   if (!Data.Dependences.empty()) {
 DepWaitTaskArgs[0] = UpLoc;
 DepWaitTaskArgs[1] = ThreadID;
@@ -4764,8 +4764,6 @@ void CGOpenMPRuntime::emitTaskCall(CodeGenFunction &CGF, 
SourceLocation Loc,
 DepWaitTaskArgs[3] = DependenciesArray.getPointer();
 DepWaitTaskArgs[4] = CGF.Builder.getInt32(0);
 DepWaitTaskArgs[5] = llvm::ConstantPointerNull::get(CGF.VoidPtrTy);
-DepWaitTaskArgs[6] =
-llvm::ConstantInt::get(CGF.Int32Ty, Data.HasNowaitClause);
   }
   auto &M = CGM.getModule();
   auto &&ElseCodeGen = [this, &M, &TaskArgs, ThreadID, NewTaskNewTaskTTy,
@@ -4777,9 +4775,9 @@ void CGOpenMPRuntime::emitTaskCall(CodeGenFunction &CGF, 
SourceLocation Loc,
 // ndeps_noalias, kmp_depend_info_t *noalias_dep_list); if dependence info
 // is specified.
 if (!Data.Dependences.empty())
-  CGF.EmitRuntimeCall(OMPBuilder.getOrCreateRuntimeFunction(
-  M, OMPRTL___kmpc_omp_taskwait_deps_51),
-  DepWaitTaskArgs);
+  CGF.EmitRuntimeCall(
+  OMPBuilder.getOrCreateRuntimeFunction(M, 
OMPRTL___kmpc_omp_wait_deps),
+  DepWaitTaskArgs);
 // Call proxy_task_entry(gtid, new_task);
 auto &&CodeGen = [TaskEntry, ThreadID, NewTaskNewTaskTTy,
   Loc](CodeGenFunction &CGF, PrePostActionTy &Action) {
@@ -5818,7 +5816,7 @@ void CGOpenMPRuntime::emitTaskwaitCall(CodeGenFunction 
&CGF, SourceLocation Loc,
 
   if (CGF.CGM.getLangOpts().OpenMPIRBuilder && Data.Dependences.empty()) {
 // TODO: Need to support taskwait with dependences in the OpenMPIRBuilder.
-OMPBuilder.createTaskwait(CGF.Builder, Data.HasNowaitClause);
+OMPBuilder.createTaskwait(CGF.Builder);
   } else {
 llvm::Value *ThreadID = getThreadID(CGF, Loc);
 llvm::Value *UpLoc = emitUpdateLocation(CGF, Loc);
@@ -5827,38 +5825,34 @@ void CGOpenMPRuntime::emitTaskwaitCall(CodeGenFunction 
&CGF, SourceLocation Loc,
 llvm::Value *NumOfElements;
 std::tie(NumOfElements, DependenciesArray) =
 emitDependClause(CGF, Data.Dependences, Loc);
+llvm::Value *DepWaitTaskArgs[6];
 if (!Data.Dependences.empty()) {
-  llvm::Value *DepWaitTaskArgs[7];
   DepWaitTaskArgs[0] = UpLoc;
   DepWaitTaskArgs[1] = ThreadID;
   DepWaitTaskArgs[2] = NumOfElements;
   DepWaitTaskArgs[3] = DependenciesArray.getPointer();