<div dir="ltr">It fails on Windows too. I was using a 32-bit build on Windows with -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON.<div><br></div><div>If you need more time for fixing this, please consider reverting it in the meantime.</div><div><br></div><div>Thanks,</div><div>Hans<br><div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 8, 2015 at 12:58 PM, Carlo Bertolli via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><p>Hi<br><br>I was unable to replicate the errors. This is what I tried:<br><br>- Run check-clang on ppc64le linux ubuntu 14.04, debug mode, llvm and clang compiled with clang 3.7.<br><br>- Run check-clang on x86-64 linux, debug and release modes, llvm and clang compiled with both clang 3.7 and gcc 4.8.2<br><br>I am using cmake+ninja,<br><br>Can you please advise on how to replicate the errors that you see, including platform, flags, etc?<br><br>Many thanks!<br><br>-- Carlo<br><br><img width="16" height="16" src="cid:2__=8FBBF586DFFD6C738f9e8a93df938690918c8FB@" border="0" alt="Inactive hide details for Alexey Samsonov ---12/08/2015 12:36:39 PM---ASan bootstrap provides an error report as well: http://l"><font color="#424282">Alexey Samsonov ---12/08/2015 12:36:39 PM---ASan bootstrap provides an error report as well: <a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-" target="_blank">http://lab.llvm.org:8011/builders/sanitizer-x86_64-</a></font><span class=""><br><br><font size="2" color="#5F5F5F">From:        </font><font size="2">Alexey Samsonov <<a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a>></font><br><font size="2" color="#5F5F5F">To:        </font><font size="2">NAKAMURA Takumi <<a href="mailto:geek4civic@gmail.com" target="_blank">geek4civic@gmail.com</a>></font><br><font size="2" color="#5F5F5F">Cc:        </font><font size="2">Carlo Bertolli/Watson/IBM@IBMUS, cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></font><br><font size="2" color="#5F5F5F">Date:        </font><font size="2">12/08/2015 12:36 PM</font><br></span><font size="2" color="#5F5F5F">Subject:        </font><font size="2">Re: r255001 - Add parse and sema for OpenMP distribute directive and all its clauses excluding dist_schedule.</font><br></p><hr width="100%" size="2" align="left" noshade style="color:rgb(128,145,165)"><div><div class="h5"><br><br><br><font size="4">ASan bootstrap provides an error report as well:</font><br><br><a href="http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/8407/steps/check-clang%20asan/logs/stdio" target="_blank"><u><font size="4" color="#0000FF">http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/8407/steps/check-clang%20asan/logs/stdio</font></u></a><br><font size="4">Please investigate or revert.</font><br><br><font size="4">On Tue, Dec 8, 2015 at 6:06 AM, NAKAMURA Takumi via cfe-commits <</font><a href="mailto:cfe-commits@lists.llvm.org" target="_blank"><u><font size="4" color="#0000FF">cfe-commits@lists.llvm.org</font></u></a><font size="4">> wrote:</font><ul><font size="4">It crashes on i686-clang. See </font><a href="http://bb.pgr.jp/builders/clang-3stage-i686-linux/builds/4055" target="_blank"><u><font size="4" color="#0000FF">http://bb.pgr.jp/builders/clang-3stage-i686-linux/builds/4055</font></u></a><br><font size="4">Investigating.</font><br><br><font size="4">#6 Â 0xf7ea482f in operator delete(void*) () from /usr/lib32/libstdc++.so.6</font><br><font size="4">#7 Â 0x0bef8cce in llvm::DenseMap<clang::VarDecl*, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<clang::VarDecl*>, llvm::detail::DenseSetPair<clang::VarDecl*> >::~DenseMap (this=0xf2419d8)</font><br><font size="4">  Â  at llvm/include/llvm/ADT/DenseMap.h:575</font><br><font size="4">#8 Â 0x0bef8c86 in llvm::DenseSet<clang::VarDecl*, llvm::DenseMapInfo<clang::VarDecl*> >::~DenseSet (this=0xf2419d8)</font><br><font size="4">  Â  at llvm/include/llvm/ADT/DenseSet.h:39</font><br><font size="4">#9 Â 0x0cf988a4 in (anonymous namespace)::DSAStackTy::SharingMapTy::~SharingMapTy (this=0xf2412c0)</font><br><font size="4">  Â  at clang/lib/Sema/SemaOpenMP.cpp:95</font><br><font size="4">#10 0x0cf9e24b in llvm::SmallVectorTemplateBase<(anonymous namespace)::DSAStackTy::SharingMapTy, false>::pop_back (this=0xf23fca0)</font><br><font size="4">  Â  at llvm/include/llvm/ADT/SmallVector.h:245</font><br><font size="4">#11 0x0cf68ed2 in (anonymous namespace)::DSAStackTy::pop (this=0xf23fca0)</font><br><font size="4">  Â  at clang/lib/Sema/SemaOpenMP.cpp:163</font><br><font size="4">#12 0x0cf68a50 in clang::Sema::EndOpenMPDSABlock (this=0xf23e188,</font><br><font size="4">  Â  CurDirective=0xf2901a0)</font><br><font size="4">  Â  at clang/lib/Sema/SemaOpenMP.cpp:957</font><br><font size="4">#13 0x0c603bf0 in clang::Parser::ParseOpenMPDeclarativeOrExecutableDirective (</font><br><font size="4">  Â  this=0xf25d3c0, StandAloneAllowed=false)</font><br><font size="4">  Â  at clang/lib/Parse/ParseOpenMP.cpp:314</font><br><font size="4">#14 0x0c61c641 in clang::Parser::ParseStatementOrDeclarationAfterAttributes (</font><br><font size="4">  Â  this=0xf25d3c0, Stmts=..., OnlyStatement=true, TrailingElseLoc=0x0,</font><br><font size="4">  Â  Attrs=...)</font><br><font size="4">  Â  at clang/lib/Parse/ParseStmt.cpp:349</font><br><font size="4">#15 0x0c61b1e9 in clang::Parser::ParseStatementOrDeclaration (this=0xf25d3c0,</font><br><font size="4">  Â  Stmts=..., OnlyStatement=true, TrailingElseLoc=0x0)</font><br><font size="4">  Â  at clang/lib/Parse/ParseStmt.cpp:106</font><br><font size="4">#16 0x0c61b064 in clang::Parser::ParseStatement (this=0xf25d3c0,</font><br><font size="4">  Â  TrailingElseLoc=0x0)</font><br><font size="4">  Â  at clang/lib/Parse/ParseStmt.cpp:42</font><br><font size="4">#17 0x0c6039ff in clang::Parser::ParseOpenMPDeclarativeOrExecutableDirective (</font><br><font size="4">  Â  this=0xf25d3c0, StandAloneAllowed=false)</font><br><font size="4">  Â  at clang/lib/Parse/ParseOpenMP.cpp:305</font><br><font size="4">#18 0x0c61c641 in clang::Parser::ParseStatementOrDeclarationAfterAttributes (</font><br><font size="4">  Â  this=0xf25d3c0, Stmts=..., OnlyStatement=true, TrailingElseLoc=0x0,</font><br><font size="4">  Â  Attrs=...)</font><br><font size="4">  Â  at clang/lib/Parse/ParseStmt.cpp:349</font><br><font size="4">#19 0x0c61b1e9 in clang::Parser::ParseStatementOrDeclaration (this=0xf25d3c0,</font><br><font size="4">  Â  Stmts=..., OnlyStatement=true, TrailingElseLoc=0x0)</font><br><font size="4">  Â  at clang/lib/Parse/ParseStmt.cpp:106</font><br><font size="4">#20 0x0c61b064 in clang::Parser::ParseStatement (this=0xf25d3c0,</font><br><font size="4">  Â  TrailingElseLoc=0x0)</font><br><font size="4">  Â  at clang/lib/Parse/ParseStmt.cpp:42</font><br><font size="4">#21 0x0c6039ff in clang::Parser::ParseOpenMPDeclarativeOrExecutableDirective (</font><br><font size="4">  Â  this=0xf25d3c0, StandAloneAllowed=true)</font><br><font size="4">  Â  at clang/lib/Parse/ParseOpenMP.cpp:305</font><br><font size="4">#22 0x0c61c641 in clang::Parser::ParseStatementOrDeclarationAfterAttributes (</font><br><font size="4">  Â  this=0xf25d3c0, Stmts=..., OnlyStatement=false, TrailingElseLoc=0x0,</font><br><font size="4">  Â  Attrs=...)</font><br><font size="4">  Â  at clang/lib/Parse/ParseStmt.cpp:349</font><br><font size="4">#23 0x0c61b1e9 in clang::Parser::ParseStatementOrDeclaration (this=0xf25d3c0,</font><br><font size="4">  Â  Stmts=..., OnlyStatement=false, TrailingElseLoc=0x0)</font><br><font size="4">  Â  at clang/lib/Parse/ParseStmt.cpp:106</font><br><font size="4">#24 0x0c625955 in clang::Parser::ParseCompoundStatementBody (this=0xf25d3c0,</font><br><font size="4">  Â  isStmtExpr=false)</font><br><font size="4">  Â  at clang/lib/Parse/ParseStmt.cpp:968</font><br><font size="4">#25 0x0c62692d in clang::Parser::ParseFunctionStatementBody (this=0xf25d3c0,</font><br><font size="4">  Â  Decl=0xf27a948, BodyScope=...)</font><br><font size="4">  Â  at clang/lib/Parse/ParseStmt.cpp:1914</font><br><font size="4">#26 0x0c53f639 in clang::Parser::ParseFunctionDefinition (this=0xf25d3c0,</font><br><font size="4">  Â  D=..., TemplateInfo=..., LateParsedAttrs=0xffffb630)</font><br><font size="4">  Â  at clang/lib/Parse/Parser.cpp:1147</font><br><font size="4">#27 0x0c56c1ca in clang::Parser::ParseDeclGroup (this=0xf25d3c0, DS=...,</font><br><font size="4">  Â  Context=0, DeclEnd=0x0, FRI=0x0)</font><br><font size="4">  Â  at clang/lib/Parse/ParseDecl.cpp:1757</font><br><font size="4">#28 0x0c53e13b in clang::Parser::ParseDeclOrFunctionDefInternal (</font><br><font size="4">  Â  this=0xf25d3c0, attrs=..., DS=..., AS=clang::AS_none)</font><br><font size="4">  Â  at clang/lib/Parse/Parser.cpp:927</font><br><font size="4">#29 0x0c53d527 in clang::Parser::ParseDeclarationOrFunctionDefinition (</font><br><font size="4">  Â  this=0xf25d3c0, attrs=..., DS=0x0, AS=clang::AS_none)</font><br><font size="4">  Â  at clang/lib/Parse/Parser.cpp:943</font><br><font size="4">#30 0x0c53c9c4 in clang::Parser::ParseExternalDeclaration (this=0xf25d3c0,</font><br><font size="4">  Â  attrs=..., DS=0x0)</font><br><font size="4">  Â  at clang/lib/Parse/Parser.cpp:801</font><br><font size="4">#31 0x0c53b4af in clang::Parser::ParseTopLevelDecl (this=0xf25d3c0, Result=...)</font><br><font size="4">  Â  at clang/lib/Parse/Parser.cpp:593</font><br><font size="4">#32 0x0c535b0d in clang::ParseAST (S=..., PrintStats=false,</font><br><font size="4">  Â  SkipFunctionBodies=false)</font><br><font size="4">  Â  at clang/lib/Parse/ParseAST.cpp:161</font><br><font size="4">#33 0x0b3bec76 in clang::ASTFrontendAction::ExecuteAction (this=0xf200980)</font><br><font size="4">  Â  at clang/lib/Frontend/FrontendAction.cpp:538</font><br><font size="4">#34 0x0b3be581 in clang::FrontendAction::Execute (this=0xf200980)</font><br><font size="4">  Â  at clang/lib/Frontend/FrontendAction.cpp:439</font><br><font size="4">#35 0x0b355071 in clang::CompilerInstance::ExecuteAction (this=0xf1ff128,</font><br><font size="4">  Â  Act=...)</font><br><font size="4">  Â  at clang/lib/Frontend/CompilerInstance.cpp:841</font><br><font size="4">#36 0x0b52d118 in clang::ExecuteCompilerInvocation (Clang=0xf1ff128)</font><br><font size="4">  Â  at clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:222</font><br><font size="4">#37 0x086e8734 in cc1_main (Argv=...,</font><br><font size="4">  Â  Argv0=0xffffd7c0 "/home/tnakamura/llvm/2-32/bin/clang",</font><br><font size="4">  Â  MainAddr=0x86d7820 <GetExecutablePath(char const*, bool)>)</font><br><font size="4">  Â  at clang/tools/driver/cc1_main.cpp:116</font><br><font size="4">#38 0x086d9823 in ExecuteCC1Tool (argv=..., Tool=...)</font><br><font size="4">  Â  at clang/tools/driver/driver.cpp:301</font><br><font size="4">#39 0x086d8316 in main (argc_=8, argv_=0xffffd684)</font><br><font size="4">  Â  at clang/tools/driver/driver.cpp:366</font><br><br><br><font size="4">On Tue, Dec 8, 2015 at 1:24 PM Carlo Bertolli via cfe-commits <</font><a href="mailto:cfe-commits@lists.llvm.org" target="_blank"><u><font size="4" color="#0000FF">cfe-commits@lists.llvm.org</font></u></a><font size="4">> wrote:</font><br><font size="4">Author: cbertol<br>Date: Mon Dec  7 22:21:03 2015<br>New Revision: 255001<br><br>URL: </font><a href="http://llvm.org/viewvc/llvm-project?rev=255001&view=rev" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project?rev=255001&view=rev</font></u></a><font size="4"><br>Log:<br>Add parse and sema for OpenMP distribute directive and all its clauses excluding dist_schedule.<br><br>Added:<br>  Â  cfe/trunk/test/OpenMP/distribute_ast_print.cpp<br>  Â  cfe/trunk/test/OpenMP/distribute_collapse_messages.cpp<br>  Â  cfe/trunk/test/OpenMP/distribute_firstprivate_messages.cpp<br>  Â  cfe/trunk/test/OpenMP/distribute_private_messages.cpp<br>Modified:<br>  Â  cfe/trunk/include/clang-c/Index.h<br>  Â  cfe/trunk/include/clang/AST/RecursiveASTVisitor.h<br>  Â  cfe/trunk/include/clang/AST/StmtOpenMP.h<br>  Â  cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>  Â  cfe/trunk/include/clang/Basic/OpenMPKinds.def<br>  Â  cfe/trunk/include/clang/Basic/OpenMPKinds.h<br>  Â  cfe/trunk/include/clang/Basic/StmtNodes.td<br>  Â  cfe/trunk/include/clang/Sema/Sema.h<br>  Â  cfe/trunk/include/clang/Serialization/ASTBitCodes.h<br>  Â  cfe/trunk/lib/AST/StmtOpenMP.cpp<br>  Â  cfe/trunk/lib/AST/StmtPrinter.cpp<br>  Â  cfe/trunk/lib/AST/StmtProfile.cpp<br>  Â  cfe/trunk/lib/Basic/OpenMPKinds.cpp<br>  Â  cfe/trunk/lib/CodeGen/CGStmt.cpp<br>  Â  cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp<br>  Â  cfe/trunk/lib/CodeGen/CodeGenFunction.h<br>  Â  cfe/trunk/lib/Parse/ParseOpenMP.cpp<br>  Â  cfe/trunk/lib/Sema/SemaOpenMP.cpp<br>  Â  cfe/trunk/lib/Sema/TreeTransform.h<br>  Â  cfe/trunk/lib/Serialization/ASTReaderStmt.cpp<br>  Â  cfe/trunk/lib/Serialization/ASTWriterStmt.cpp<br>  Â  cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp<br>  Â  cfe/trunk/test/OpenMP/nesting_of_regions.cpp<br>  Â  cfe/trunk/tools/libclang/CIndex.cpp<br>  Â  cfe/trunk/tools/libclang/CXCursor.cpp<br><br>Modified: cfe/trunk/include/clang-c/Index.h<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/include/clang-c/Index.h (original)<br>+++ cfe/trunk/include/clang-c/Index.h Mon Dec  7 22:21:03 2015<br>@@ -2264,7 +2264,11 @@ enum CXCursorKind {<br>  Â  */<br>  Â CXCursor_OMPTaskLoopSimdDirective  Â  Â  = 259,<br><br>-  CXCursor_LastStmt  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  = CXCursor_OMPTaskLoopSimdDirective,<br>+  Â /** \brief OpenMP distribute directive.<br>+  Â */<br>+  CXCursor_OMPDistributeDirective  Â  Â  Â  = 260,<br>+<br>+  CXCursor_LastStmt  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  = CXCursor_OMPDistributeDirective,<br><br>  Â /**<br>  Â  * \brief Cursor that represents the translation unit itself.<br><br>Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)<br>+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Mon Dec  7 22:21:03 2015<br>@@ -2439,6 +2439,9 @@ DEF_TRAVERSE_STMT(OMPTaskLoopDirective,<br> DEF_TRAVERSE_STMT(OMPTaskLoopSimdDirective,<br>  Â  Â  Â  Â  Â  Â  Â  Â  Â { TRY_TO(TraverseOMPExecutableDirective(S)); })<br><br>+DEF_TRAVERSE_STMT(OMPDistributeDirective,<br>+  Â  Â  Â  Â  Â  Â  Â  Â  { TRY_TO(TraverseOMPExecutableDirective(S)); })<br>+<br> // OpenMP clauses.<br> template <typename Derived><br> bool RecursiveASTVisitor<Derived>::TraverseOMPClause(OMPClause *C) {<br><br>Modified: cfe/trunk/include/clang/AST/StmtOpenMP.h<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtOpenMP.h?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtOpenMP.h?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/include/clang/AST/StmtOpenMP.h (original)<br>+++ cfe/trunk/include/clang/AST/StmtOpenMP.h Mon Dec  7 22:21:03 2015<br>@@ -424,43 +424,50 @@ protected:<br>  Â void setInc(Expr *Inc) { *std::next(child_begin(), IncOffset) = Inc; }<br>  Â void setIsLastIterVariable(Expr *IL) {<br>  Â  Â assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||<br>-  Â  Â  Â  Â  Â  isOpenMPTaskLoopDirective(getDirectiveKind())) &&<br>+  Â  Â  Â  Â  Â  isOpenMPTaskLoopDirective(getDirectiveKind()) ||<br>+  Â  Â  Â  Â  Â  isOpenMPDistributeDirective(getDirectiveKind())) &&<br>  Â  Â  Â  Â  Â  "expected worksharing loop directive");<br>  Â  Â *std::next(child_begin(), IsLastIterVariableOffset) = IL;<br>  Â }<br>  Â void setLowerBoundVariable(Expr *LB) {<br>  Â  Â assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||<br>-  Â  Â  Â  Â  Â  isOpenMPTaskLoopDirective(getDirectiveKind())) &&<br>+  Â  Â  Â  Â  Â  isOpenMPTaskLoopDirective(getDirectiveKind()) ||<br>+  Â  Â  Â  Â  Â  isOpenMPDistributeDirective(getDirectiveKind())) &&<br>  Â  Â  Â  Â  Â  "expected worksharing loop directive");<br>  Â  Â *std::next(child_begin(), LowerBoundVariableOffset) = LB;<br>  Â }<br>  Â void setUpperBoundVariable(Expr *UB) {<br>  Â  Â assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||<br>-  Â  Â  Â  Â  Â  isOpenMPTaskLoopDirective(getDirectiveKind())) &&<br>+  Â  Â  Â  Â  Â  isOpenMPTaskLoopDirective(getDirectiveKind()) ||<br>+  Â  Â  Â  Â  Â  isOpenMPDistributeDirective(getDirectiveKind())) &&<br>  Â  Â  Â  Â  Â  "expected worksharing loop directive");<br>  Â  Â *std::next(child_begin(), UpperBoundVariableOffset) = UB;<br>  Â }<br>  Â void setStrideVariable(Expr *ST) {<br>  Â  Â assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||<br>-  Â  Â  Â  Â  Â  isOpenMPTaskLoopDirective(getDirectiveKind())) &&<br>+  Â  Â  Â  Â  Â  isOpenMPTaskLoopDirective(getDirectiveKind()) ||<br>+  Â  Â  Â  Â  Â  isOpenMPDistributeDirective(getDirectiveKind())) &&<br>  Â  Â  Â  Â  Â  "expected worksharing loop directive");<br>  Â  Â *std::next(child_begin(), StrideVariableOffset) = ST;<br>  Â }<br>  Â void setEnsureUpperBound(Expr *EUB) {<br>  Â  Â assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||<br>-  Â  Â  Â  Â  Â  isOpenMPTaskLoopDirective(getDirectiveKind())) &&<br>+  Â  Â  Â  Â  Â  isOpenMPTaskLoopDirective(getDirectiveKind()) ||<br>+  Â  Â  Â  Â  Â  isOpenMPDistributeDirective(getDirectiveKind())) &&<br>  Â  Â  Â  Â  Â  "expected worksharing loop directive");<br>  Â  Â *std::next(child_begin(), EnsureUpperBoundOffset) = EUB;<br>  Â }<br>  Â void setNextLowerBound(Expr *NLB) {<br>  Â  Â assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||<br>-  Â  Â  Â  Â  Â  isOpenMPTaskLoopDirective(getDirectiveKind())) &&<br>+  Â  Â  Â  Â  Â  isOpenMPTaskLoopDirective(getDirectiveKind()) ||<br>+  Â  Â  Â  Â  Â  isOpenMPDistributeDirective(getDirectiveKind())) &&<br>  Â  Â  Â  Â  Â  "expected worksharing loop directive");<br>  Â  Â *std::next(child_begin(), NextLowerBoundOffset) = NLB;<br>  Â }<br>  Â void setNextUpperBound(Expr *NUB) {<br>  Â  Â assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||<br>-  Â  Â  Â  Â  Â  isOpenMPTaskLoopDirective(getDirectiveKind())) &&<br>+  Â  Â  Â  Â  Â  isOpenMPTaskLoopDirective(getDirectiveKind()) ||<br>+  Â  Â  Â  Â  Â  isOpenMPDistributeDirective(getDirectiveKind())) &&<br>  Â  Â  Â  Â  Â  "expected worksharing loop directive");<br>  Â  Â *std::next(child_begin(), NextUpperBoundOffset) = NUB;<br>  Â }<br>@@ -683,7 +690,8 @@ public:<br>  Â  Â  Â  Â  Â  T->getStmtClass() == OMPParallelForDirectiveClass ||<br>  Â  Â  Â  Â  Â  T->getStmtClass() == OMPParallelForSimdDirectiveClass ||<br>  Â  Â  Â  Â  Â  T->getStmtClass() == OMPTaskLoopDirectiveClass ||<br>-  Â  Â  Â  Â  Â T->getStmtClass() == OMPTaskLoopSimdDirectiveClass;<br>+  Â  Â  Â  Â  Â T->getStmtClass() == OMPTaskLoopSimdDirectiveClass ||<br>+  Â  Â  Â  Â  Â T->getStmtClass() == OMPDistributeDirectiveClass;<br>  Â }<br> };<br><br>@@ -2333,6 +2341,73 @@ public:<br>  Â }<br> };<br><br>+/// \brief This represents '#pragma omp distribute' directive.<br>+///<br>+/// \code<br>+/// #pragma omp distribute private(a,b)<br>+/// \endcode<br>+/// In this example directive '#pragma omp distribute' has clauses 'private'<br>+/// with the variables 'a' and 'b'<br>+///<br>+class OMPDistributeDirective : public OMPLoopDirective {<br>+  friend class ASTStmtReader;<br>+<br>+  /// \brief Build directive with the given start and end location.<br>+  ///<br>+  /// \param StartLoc Starting location of the directive kind.<br>+  /// \param EndLoc Ending location of the directive.<br>+  /// \param CollapsedNum Number of collapsed nested loops.<br>+  /// \param NumClauses Number of clauses.<br>+  ///<br>+  OMPDistributeDirective(SourceLocation StartLoc, SourceLocation EndLoc,<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â unsigned CollapsedNum, unsigned NumClauses)<br>+  Â  Â  : OMPLoopDirective(this, OMPDistributeDirectiveClass, OMPD_distribute,<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â StartLoc, EndLoc, CollapsedNum, NumClauses)<br>+  Â  Â  Â  {}<br>+<br>+  /// \brief Build an empty directive.<br>+  ///<br>+  /// \param CollapsedNum Number of collapsed nested loops.<br>+  /// \param NumClauses Number of clauses.<br>+  ///<br>+  explicit OMPDistributeDirective(unsigned CollapsedNum, unsigned NumClauses)<br>+  Â  Â  : OMPLoopDirective(this, OMPDistributeDirectiveClass, OMPD_distribute,<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â SourceLocation(), SourceLocation(), CollapsedNum,<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â NumClauses)<br>+  Â  Â  Â  {}<br>+<br>+public:<br>+  /// \brief Creates directive with a list of \a Clauses.<br>+  ///<br>+  /// \param C AST context.<br>+  /// \param StartLoc Starting location of the directive kind.<br>+  /// \param EndLoc Ending Location of the directive.<br>+  /// \param CollapsedNum Number of collapsed loops.<br>+  /// \param Clauses List of clauses.<br>+  /// \param AssociatedStmt Statement, associated with the directive.<br>+  /// \param Exprs Helper expressions for CodeGen.<br>+  Â  ///<br>+  static OMPDistributeDirective *<br>+  Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,<br>+  Â  Â  Â  Â unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,<br>+  Â  Â  Â  Â Stmt *AssociatedStmt, const HelperExprs &Exprs);<br>+<br>+  /// \brief Creates an empty directive with the place<br>+  /// for \a NumClauses clauses.<br>+  ///<br>+  /// \param C AST context.<br>+  /// \param CollapsedNum Number of collapsed nested loops.<br>+  /// \param NumClauses Number of clauses.<br>+  ///<br>+  static OMPDistributeDirective *CreateEmpty(const ASTContext &C,<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â unsigned NumClauses,<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â unsigned CollapsedNum, EmptyShell);<br>+<br>+  static bool classof(const Stmt *T) {<br>+  Â  return T->getStmtClass() == OMPDistributeDirectiveClass;<br>+  }<br>+};<br>+<br> } // end namespace clang<br><br> #endif<br><br>Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)<br>+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Dec  7 22:21:03 2015<br>@@ -7801,7 +7801,8 @@ def err_omp_prohibited_region : Error<<br>  Â "region cannot be%select{| closely}0 nested inside '%1' region"<br>  Â "%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?|"<br>  Â "; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|"<br>-  "; perhaps you forget to enclose 'omp %3' directive into a target region?}2">;<br>+  "; perhaps you forget to enclose 'omp %3' directive into a target region?|"<br>+  "; perhaps you forget to enclose 'omp %3' directive into a teams region?}2">;<br> def err_omp_prohibited_region_simd : Error<<br>  Â "OpenMP constructs may not be nested inside a simd region">;<br> def err_omp_prohibited_region_atomic : Error<<br>@@ -7920,6 +7921,12 @@ def err_omp_wrong_ordered_loop_count : E<br>  Â "the parameter of the 'ordered' clause must be greater than or equal to the parameter of the 'collapse' clause">;<br> def note_collapse_loop_count : Note<<br>  Â "parameter of the 'collapse' clause">;<br>+def err_omp_firstprivate_distribute_private_teams : Error<<br>+  "private variable in '#pragma omp teams' cannot be firstprivate in '#pragma omp distribute'">;<br>+def err_omp_firstprivate_and_lastprivate_in_distribute : Error<<br>+  "lastprivate variable cannot be firstprivate in '#pragma omp distribute'">;<br>+def err_omp_firstprivate_distribute_in_teams_reduction : Error<<br>+  "reduction variable in '#pragma omp teams' cannot be firstprivate in '#pragma omp distribute'">;<br> } // end of OpenMP category<br><br> let CategoryName = "Related Result Type Issue" in {<br><br>Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original)<br>+++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Mon Dec  7 22:21:03 2015<br>@@ -75,6 +75,9 @@<br> #ifndef OPENMP_TASKLOOP_SIMD_CLAUSE<br> #  define OPENMP_TASKLOOP_SIMD_CLAUSE(Name)<br> #endif<br>+#ifndef OPENMP_DISTRIBUTE_CLAUSE<br>+#define OPENMP_DISTRIBUTE_CLAUSE(Name)<br>+#endif<br> #ifndef OPENMP_DEFAULT_KIND<br> #  define OPENMP_DEFAULT_KIND(Name)<br> #endif<br>@@ -123,6 +126,7 @@ OPENMP_DIRECTIVE_EXT(for_simd, "for simd<br> OPENMP_DIRECTIVE_EXT(cancellation_point, "cancellation point")<br> OPENMP_DIRECTIVE(taskloop)<br> OPENMP_DIRECTIVE_EXT(taskloop_simd, "taskloop simd")<br>+OPENMP_DIRECTIVE(distribute)<br><br> // OpenMP clauses.<br> OPENMP_CLAUSE(if, OMPIfClause)<br>@@ -388,6 +392,12 @@ OPENMP_TASKLOOP_SIMD_CLAUSE(simdlen)<br> OPENMP_TASKLOOP_SIMD_CLAUSE(grainsize)<br> OPENMP_TASKLOOP_SIMD_CLAUSE(nogroup)<br><br>+// Clauses allowed for OpenMP directive 'distribute'<br>+OPENMP_DISTRIBUTE_CLAUSE(private)<br>+OPENMP_DISTRIBUTE_CLAUSE(firstprivate)<br>+OPENMP_DISTRIBUTE_CLAUSE(lastprivate)<br>+OPENMP_DISTRIBUTE_CLAUSE(collapse)<br>+<br> #undef OPENMP_TASKLOOP_SIMD_CLAUSE<br> #undef OPENMP_TASKLOOP_CLAUSE<br> #undef OPENMP_LINEAR_KIND<br>@@ -415,3 +425,4 @@ OPENMP_TASKLOOP_SIMD_CLAUSE(nogroup)<br> #undef OPENMP_FOR_CLAUSE<br> #undef OPENMP_FOR_SIMD_CLAUSE<br> #undef OPENMP_MAP_KIND<br>+#undef OPENMP_DISTRIBUTE_CLAUSE<br><br>Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.h<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.h?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.h?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/include/clang/Basic/OpenMPKinds.h (original)<br>+++ cfe/trunk/include/clang/Basic/OpenMPKinds.h Mon Dec  7 22:21:03 2015<br>@@ -141,6 +141,13 @@ bool isOpenMPTeamsDirective(OpenMPDirect<br> /// otherwise - false.<br> bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind);<br><br>+/// \brief Checks if the specified directive is a distribute directive.<br>+/// \param DKind Specified directive.<br>+/// \return true - the directive is a distribute-directive like 'omp<br>+/// distribute',<br>+/// otherwise - false.<br>+bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind);<br>+<br> /// \brief Checks if the specified clause is one of private clauses like<br> /// 'private', 'firstprivate', 'reduction' etc..<br> /// \param Kind Clause kind.<br><br>Modified: cfe/trunk/include/clang/Basic/StmtNodes.td<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/StmtNodes.td?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/StmtNodes.td?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/include/clang/Basic/StmtNodes.td (original)<br>+++ cfe/trunk/include/clang/Basic/StmtNodes.td Mon Dec  7 22:21:03 2015<br>@@ -221,4 +221,4 @@ def OMPCancellationPointDirective : DStm<br> def OMPCancelDirective : DStmt<OMPExecutableDirective>;<br> def OMPTaskLoopDirective : DStmt<OMPLoopDirective>;<br> def OMPTaskLoopSimdDirective : DStmt<OMPLoopDirective>;<br>-<br>+def OMPDistributeDirective : DStmt<OMPLoopDirective>;<br><br>Modified: cfe/trunk/include/clang/Sema/Sema.h<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/include/clang/Sema/Sema.h (original)<br>+++ cfe/trunk/include/clang/Sema/Sema.h Mon Dec  7 22:21:03 2015<br>@@ -7961,6 +7961,12 @@ public:<br>  Â  Â  Â ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,<br>  Â  Â  Â SourceLocation EndLoc,<br>  Â  Â  Â llvm::DenseMap<VarDecl *, Expr *> &VarsWithImplicitDSA);<br>+  /// \brief Called on well-formed '\#pragma omp distribute' after parsing<br>+  /// of the associated statement.<br>+  StmtResult ActOnOpenMPDistributeDirective(<br>+  Â  Â  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,<br>+  Â  Â  SourceLocation EndLoc,<br>+  Â  Â  llvm::DenseMap<VarDecl *, Expr *> &VarsWithImplicitDSA);<br><br>  Â OMPClause *ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind,<br>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Expr *Expr,<br><br>Modified: cfe/trunk/include/clang/Serialization/ASTBitCodes.h<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/include/clang/Serialization/ASTBitCodes.h (original)<br>+++ cfe/trunk/include/clang/Serialization/ASTBitCodes.h Mon Dec  7 22:21:03 2015<br>@@ -1449,6 +1449,7 @@ namespace clang {<br>  Â  Â  Â STMT_OMP_CANCEL_DIRECTIVE,<br>  Â  Â  Â STMT_OMP_TASKLOOP_DIRECTIVE,<br>  Â  Â  Â STMT_OMP_TASKLOOP_SIMD_DIRECTIVE,<br>+  Â  Â  STMT_OMP_DISTRIBUTE_DIRECTIVE,<br>  Â  Â  Â EXPR_OMP_ARRAY_SECTION,<br><br>  Â  Â  Â // ARC<br><br>Modified: cfe/trunk/lib/AST/StmtOpenMP.cpp<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtOpenMP.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtOpenMP.cpp?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/lib/AST/StmtOpenMP.cpp (original)<br>+++ cfe/trunk/lib/AST/StmtOpenMP.cpp Mon Dec  7 22:21:03 2015<br>@@ -832,3 +832,48 @@ OMPTaskLoopSimdDirective::CreateEmpty(co<br>  Â return new (Mem) OMPTaskLoopSimdDirective(CollapsedNum, NumClauses);<br> }<br><br>+OMPDistributeDirective *OMPDistributeDirective::Create(<br>+  Â  const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,<br>+  Â  unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,<br>+  Â  const HelperExprs &Exprs) {<br>+  unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPDistributeDirective),<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â llvm::alignOf<OMPClause *>());<br>+  void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â sizeof(Stmt *) *<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â numLoopChildren(CollapsedNum, OMPD_distribute));<br>+  OMPDistributeDirective *Dir = new (Mem)<br>+  Â  Â  OMPDistributeDirective(StartLoc, EndLoc, CollapsedNum, Clauses.size());<br>+  Dir->setClauses(Clauses);<br>+  Dir->setAssociatedStmt(AssociatedStmt);<br>+  Dir->setIterationVariable(Exprs.IterationVarRef);<br>+  Dir->setLastIteration(Exprs.LastIteration);<br>+  Dir->setCalcLastIteration(Exprs.CalcLastIteration);<br>+  Dir->setPreCond(Exprs.PreCond);<br>+  Dir->setCond(Exprs.Cond);<br>+  Dir->setInit(Exprs.Init);<br>+  Dir->setInc(Exprs.Inc);<br>+  Dir->setIsLastIterVariable(Exprs.IL);<br>+  Dir->setLowerBoundVariable(Exprs.LB);<br>+  Dir->setUpperBoundVariable(Exprs.UB);<br>+  Dir->setStrideVariable(Exprs.ST);<br>+  Dir->setEnsureUpperBound(Exprs.EUB);<br>+  Dir->setNextLowerBound(Exprs.NLB);<br>+  Dir->setNextUpperBound(Exprs.NUB);<br>+  Dir->setCounters(Exprs.Counters);<br>+  Dir->setPrivateCounters(Exprs.PrivateCounters);<br>+  Dir->setInits(Exprs.Inits);<br>+  Dir->setUpdates(Exprs.Updates);<br>+  Dir->setFinals(Exprs.Finals);<br>+  return Dir;<br>+}<br>+<br>+OMPDistributeDirective *<br>+OMPDistributeDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  unsigned CollapsedNum, EmptyShell) {<br>+  unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPDistributeDirective),<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â llvm::alignOf<OMPClause *>());<br>+  void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â sizeof(Stmt *) *<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â numLoopChildren(CollapsedNum, OMPD_distribute));<br>+  return new (Mem) OMPDistributeDirective(CollapsedNum, NumClauses);<br>+}<br><br>Modified: cfe/trunk/lib/AST/StmtPrinter.cpp<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/lib/AST/StmtPrinter.cpp (original)<br>+++ cfe/trunk/lib/AST/StmtPrinter.cpp Mon Dec  7 22:21:03 2015<br>@@ -1057,6 +1057,11 @@ void StmtPrinter::VisitOMPTaskLoopSimdDi<br>  Â PrintOMPExecutableDirective(Node);<br> }<br><br>+void StmtPrinter::VisitOMPDistributeDirective(OMPDistributeDirective *Node) {<br>+  Indent() << "#pragma omp distribute ";<br>+  PrintOMPExecutableDirective(Node);<br>+}<br>+<br> //===----------------------------------------------------------------------===//<br> //  Expr printing methods.<br> //===----------------------------------------------------------------------===//<br><br>Modified: cfe/trunk/lib/AST/StmtProfile.cpp<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/lib/AST/StmtProfile.cpp (original)<br>+++ cfe/trunk/lib/AST/StmtProfile.cpp Mon Dec  7 22:21:03 2015<br>@@ -599,6 +599,11 @@ void StmtProfiler::VisitOMPTaskLoopSimdD<br>  Â VisitOMPLoopDirective(S);<br> }<br><br>+void StmtProfiler::VisitOMPDistributeDirective(<br>+  Â  const OMPDistributeDirective *S) {<br>+  VisitOMPLoopDirective(S);<br>+}<br>+<br> void StmtProfiler::VisitExpr(const Expr *S) {<br>  Â VisitStmt(S);<br> }<br><br>Modified: cfe/trunk/lib/Basic/OpenMPKinds.cpp<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/OpenMPKinds.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/OpenMPKinds.cpp?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/lib/Basic/OpenMPKinds.cpp (original)<br>+++ cfe/trunk/lib/Basic/OpenMPKinds.cpp Mon Dec  7 22:21:03 2015<br>@@ -436,6 +436,16 @@ bool clang::isAllowedClauseForDirective(<br>  Â  Â  Â break;<br>  Â  Â }<br>  Â  Â break;<br>+  case OMPD_distribute:<br>+  Â  switch (CKind) {<br>+#define OPENMP_DISTRIBUTE_CLAUSE(Name)  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â \<br>+  case OMPC_##Name:  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  \<br>+  Â  return true;<br>+#include "clang/Basic/OpenMPKinds.def"<br>+  Â  default:<br>+  Â  Â  break;<br>+  Â  }<br>+  Â  break;<br>  Â case OMPD_unknown:<br>  Â case OMPD_threadprivate:<br>  Â case OMPD_section:<br>@@ -455,7 +465,8 @@ bool clang::isOpenMPLoopDirective(OpenMP<br>  Â return DKind == OMPD_simd || DKind == OMPD_for || DKind == OMPD_for_simd ||<br>  Â  Â  Â  Â  DKind == OMPD_parallel_for || DKind == OMPD_parallel_for_simd ||<br>  Â  Â  Â  Â  DKind == OMPD_taskloop ||<br>-  Â  Â  Â  Â DKind == OMPD_taskloop_simd; // TODO add next directives.<br>+  Â  Â  Â  Â DKind == OMPD_taskloop_simd ||<br>+  Â  Â  Â  Â DKind == OMPD_distribute; // TODO add next directives.<br> }<br><br> bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) {<br>@@ -490,6 +501,10 @@ bool clang::isOpenMPSimdDirective(OpenMP<br>  Â  Â  Â  Â  DKind == OMPD_taskloop_simd; // TODO add next directives.<br> }<br><br>+bool clang::isOpenMPDistributeDirective(OpenMPDirectiveKind Kind) {<br>+  return Kind == OMPD_distribute; // TODO add next directives.<br>+}<br>+<br> bool clang::isOpenMPPrivate(OpenMPClauseKind Kind) {<br>  Â return Kind == OMPC_private || Kind == OMPC_firstprivate ||<br>  Â  Â  Â  Â  Kind == OMPC_lastprivate || Kind == OMPC_linear ||<br><br>Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)<br>+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Mon Dec  7 22:21:03 2015<br>@@ -262,6 +262,9 @@ void CodeGenFunction::EmitStmt(const Stm<br>  Â case Stmt::OMPTaskLoopSimdDirectiveClass:<br>  Â  Â EmitOMPTaskLoopSimdDirective(cast<OMPTaskLoopSimdDirective>(*S));<br>  Â  Â break;<br>+case Stmt::OMPDistributeDirectiveClass:<br>+  Â  EmitOMPDistributeDirective(cast<OMPDistributeDirective>(*S));<br>+  Â  Â  Â break;<br>  Â }<br> }<br><br><br>Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)<br>+++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Mon Dec  7 22:21:03 2015<br>@@ -2045,6 +2045,11 @@ void CodeGenFunction::EmitOMPFlushDirect<br>  Â }(), S.getLocStart());<br> }<br><br>+void CodeGenFunction::EmitOMPDistributeDirective(<br>+  Â  const OMPDistributeDirective &S) {<br>+  llvm_unreachable("CodeGen for 'omp distribute' is not supported yet.");<br>+}<br>+<br> static llvm::Function *emitOutlinedOrderedFunction(CodeGenModule &CGM,<br>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  const CapturedStmt *S) {<br>  Â CodeGenFunction CGF(CGM, /*suppressNewContext=*/true);<br><br>Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)<br>+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Mon Dec  7 22:21:03 2015<br>@@ -2339,6 +2339,7 @@ public:<br>  Â void EmitOMPCancelDirective(const OMPCancelDirective &S);<br>  Â void EmitOMPTaskLoopDirective(const OMPTaskLoopDirective &S);<br>  Â void EmitOMPTaskLoopSimdDirective(const OMPTaskLoopSimdDirective &S);<br>+  void EmitOMPDistributeDirective(const OMPDistributeDirective &S);<br><br>  Â /// \brief Emit inner loop of the worksharing/simd construct.<br>  Â ///<br><br>Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original)<br>+++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Mon Dec  7 22:21:03 2015<br>@@ -140,6 +140,7 @@ Parser::DeclGroupPtrTy Parser::ParseOpen<br>  Â case OMPD_target_data:<br>  Â case OMPD_taskloop:<br>  Â case OMPD_taskloop_simd:<br>+  case OMPD_distribute:<br>  Â  Â Diag(Tok, diag::err_omp_unexpected_directive)<br>  Â  Â  Â  Â << getOpenMPDirectiveName(DKind);<br>  Â  Â break;<br>@@ -160,7 +161,8 @@ Parser::DeclGroupPtrTy Parser::ParseOpen<br> ///  Â  Â  Â  Â 'parallel for' | 'parallel sections' | 'task' | 'taskyi
eld' |<br> ///  Â  Â  Â  Â 'barrier' | 'taskwait' | 'flush' | 'ordered' | 'atomic' |<br> ///  Â  Â  Â  Â 'for simd' | 'parallel for simd' | 'target' | 'target data' |<br>-///  Â  Â  Â  Â 'taskgroup' | 'teams' | 'taskloop' | 'taskloop simd' {clause}<br>+///  Â  Â  Â  Â 'taskgroup' | 'teams' | 'taskloop' | 'taskloop simd' {clause} |<br>+///  Â  Â  Â  Â 'distribute'<br> ///  Â  Â  Â  Â annot_pragma_openmp_end<br> ///<br> StmtResult<br>@@ -237,7 +239,8 @@ Parser::ParseOpenMPDeclarativeOrExecutab<br>  Â case OMPD_taskgroup:<br>  Â case OMPD_target_data:<br>  Â case OMPD_taskloop:<br>-  case OMPD_taskloop_simd: {<br>+  case OMPD_taskloop_simd:<br>+  case OMPD_distribute: {<br>  Â  Â ConsumeToken();<br>  Â  Â // Parse directive name of the 'critical' directive if any.<br>  Â  Â if (DKind == OMPD_critical) {<br><br>Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)<br>+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Mon Dec  7 22:21:03 2015<br>@@ -1568,6 +1568,14 @@ void Sema::ActOnOpenMPRegionStart(OpenMP<br>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Params);<br>  Â  Â break;<br>  Â }<br>+  case OMPD_distribute: {<br>+  Â  Sema::CapturedParamNameType Params[] = {<br>+  Â  Â  Â  std::make_pair(StringRef(), QualType()) // __context with shared vars<br>+  Â  };<br>+  Â  ActOnCapturedRegionStart(DSAStack->getConstructLoc(), CurScope, CR_OpenMP,<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â Params);<br>+  Â  break;<br>+  }<br>  Â case OMPD_threadprivate:<br>  Â case OMPD_taskyield:<br>  Â case OMPD_barrier:<br>@@ -1652,6 +1660,7 @@ static bool CheckNestingOfRegions(Sema &<br>  Â // | parallel  Â  Â  Â  Â | cancel  Â  Â  Â  Â  | !  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | parallel  Â  Â  Â  Â | taskloop  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | parallel  Â  Â  Â  Â | taskloop simd  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |</font><br><font size="4">+  // | parallel  Â  Â  Â  Â | distribute  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // +------------------+-----------------+------------------------------------+<br>  Â // | for  Â  Â  Â  Â  Â  Â  | parallel  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | for  Â  Â  Â  Â  Â  Â  | for  Â  Â  Â  Â  Â  Â | +  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>@@ -1680,6 +1689,7 @@ static bool CheckNestingOfRegions(Sema &<br>  Â // | for  Â  Â  Â  Â  Â  Â  | cancel  Â  Â  Â  Â  | !  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | for  Â  Â  Â  Â  Â  Â  | taskloop  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | for  Â  Â  Â  Â  Â  Â  | taskloop simd  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | for  Â  Â  Â  Â  Â  Â  | distribute  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // +------------------+-----------------+------------------------------------+<br>  Â // | master  Â  Â  Â  Â  Â | parallel  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | master  Â  Â  Â  Â  Â | for  Â  Â  Â  Â  Â  Â | +  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>@@ -1708,6 +1718,7 @@ static bool CheckNestingOfRegions(Sema &<br>  Â // | master  Â  Â  Â  Â  Â | cancel  Â  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | master  Â  Â  Â  Â  Â | taskloop  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | master  Â  Â  Â  Â  Â | taskloop simd  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | master  Â  Â  Â  Â  Â | distribute  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // +------------------+-----------------+------------------------------------+<br>  Â // | critical  Â  Â  Â  Â | parallel  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | critical  Â  Â  Â  Â | for  Â  Â  Â  Â  Â  Â | +  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>@@ -1735,6 +1746,7 @@ static bool CheckNestingOfRegions(Sema &<br>  Â // | critical  Â  Â  Â  Â | cancel  Â  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | critical  Â  Â  Â  Â | taskloop  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | critical  Â  Â  Â  Â | taskloop simd  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | critical  Â  Â  Â  Â | distribute  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // +------------------+-----------------+------------------------------------+<br>  Â // | simd  Â  Â  Â  Â  Â  Â | parallel  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | simd  Â  Â  Â  Â  Â  Â | for  Â  Â  Â  Â  Â  Â |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>@@ -1763,6 +1775,7 @@ static bool CheckNestingOfRegions(Sema &<br>  Â // | simd  Â  Â  Â  Â  Â  Â | cancel  Â  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | simd  Â  Â  Â  Â  Â  Â | taskloop  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | simd  Â  Â  Â  Â  Â  Â | taskloop simd  Â |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | simd  Â  Â  Â  Â  Â  Â | distribute  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // +------------------+-----------------+------------------------------------+<br>  Â // | for simd  Â  Â  Â  Â | parallel  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | for simd  Â  Â  Â  Â | for  Â  Â  Â  Â  Â  Â |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>@@ -1791,6 +1804,7 @@ static bool CheckNestingOfRegions(Sema &<br>  Â // | for simd  Â  Â  Â  Â | cancel  Â  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | for simd  Â  Â  Â  Â | taskloop  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | for simd  Â  Â  Â  Â | taskloop simd  Â |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | for simd  Â  Â  Â  Â | distribute  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // +------------------+-----------------+------------------------------------+<br>  Â // | parallel for simd| parallel  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | parallel for simd| for  Â  Â  Â  Â  Â  Â |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>@@ -1819,6 +1833,7 @@ static bool CheckNestingOfRegions(Sema &<br>  Â // | parallel for simd| cancel  Â  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | parallel for simd| taskloop  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | parallel for simd| taskloop simd  Â |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | parallel for simd| distribute  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // +------------------+-----------------+------------------------------------+<br>  Â // | sections  Â  Â  Â  Â | parallel  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | sections  Â  Â  Â  Â | for  Â  Â  Â  Â  Â  Â | +  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>@@ -1847,6 +1862,7 @@ static bool CheckNestingOfRegions(Sema &<br>  Â // | sections  Â  Â  Â  Â | cancel  Â  Â  Â  Â  | !  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | sections  Â  Â  Â  Â | taskloop  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | sections  Â  Â  Â  Â | taskloop simd  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | sections  Â  Â  Â  Â | distribute  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // +------------------+-----------------+------------------------------------+<br>  Â // | section  Â  Â  Â  Â  | parallel  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | section  Â  Â  Â  Â  | for  Â  Â  Â  Â  Â  Â | +  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>@@ -1875,6 +1891,7 @@ static bool CheckNestingOfRegions(Sema &<br>  Â // | section  Â  Â  Â  Â  | cancel  Â  Â  Â  Â  | !  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | section  Â  Â  Â  Â  | taskloop  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | section  Â  Â  Â  Â  | taskloop simd  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | section  Â  Â  Â  Â  | distribute  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // +------------------+-----------------+------------------------------------+<br>  Â // | single  Â  Â  Â  Â  Â | parallel  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | single  Â  Â  Â  Â  Â | for  Â  Â  Â  Â  Â  Â | +  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>@@ -1903,6 +1920,7 @@ static bool CheckNestingOfRegions(Sema &<br>  Â // | single  Â  Â  Â  Â  Â | cancel  Â  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | single  Â  Â  Â  Â  Â | taskloop  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | single  Â  Â  Â  Â  Â | taskloop simd  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | single  Â  Â  Â  Â  Â | distribute  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // +------------------+-----------------+------------------------------------+<br>  Â // | parallel for  Â  Â | parallel  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | parallel for  Â  Â | for  Â  Â  Â  Â  Â  Â | +  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>@@ -1931,6 +1949,7 @@ static bool CheckNestingOfRegions(Sema &<br>  Â // | parallel for  Â  Â | cancel  Â  Â  Â  Â  | !  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | parallel for  Â  Â | taskloop  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | parallel for  Â  Â | taskloop simd  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | parallel for  Â  Â | distribute  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // +------------------+-----------------+------------------------------------+<br>  Â // | parallel sections| parallel  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | parallel sections| for  Â  Â  Â  Â  Â  Â | +  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>@@ -1959,6 +1978,7 @@ static bool CheckNestingOfRegions(Sema &<br>  Â // | parallel sections| cancel  Â  Â  Â  Â  | !  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | parallel sections| taskloop  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | parallel sections| taskloop simd  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | parallel sections| distribute  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // +------------------+-----------------+------------------------------------+<br>  Â // | task  Â  Â  Â  Â  Â  Â | parallel  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | task  Â  Â  Â  Â  Â  Â | for  Â  Â  Â  Â  Â  Â | +  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>@@ -1987,6 +2007,7 @@ static bool CheckNestingOfRegions(Sema &<br>  Â // | task  Â  Â  Â  Â  Â  Â | cancel  Â  Â  Â  Â  | !  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | task  Â  Â  Â  Â  Â  Â | taskloop  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | task  Â  Â  Â  Â  Â  Â | taskloop simd  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | task  Â  Â  Â  Â  Â  Â | distribute  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // +------------------+-----------------+------------------------------------+<br>  Â // | ordered  Â  Â  Â  Â  | parallel  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | ordered  Â  Â  Â  Â  | for  Â  Â  Â  Â  Â  Â | +  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>@@ -2015,6 +2036,7 @@ static bool CheckNestingOfRegions(Sema &<br>  Â // | ordered  Â  Â  Â  Â  | cancel  Â  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | ordered  Â  Â  Â  Â  | taskloop  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | ordered  Â  Â  Â  Â  | taskloop simd  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | ordered  Â  Â  Â  Â  | distribute  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // +------------------+-----------------+------------------------------------+<br>  Â // | atomic  Â  Â  Â  Â  Â | parallel  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | atomic  Â  Â  Â  Â  Â | for  Â  Â  Â  Â  Â  Â |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>@@ -2043,6 +2065,7 @@ static bool CheckNestingOfRegions(Sema &<br>  Â // | atomic  Â  Â  Â  Â  Â | cancel  Â  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | atomic  Â  Â  Â  Â  Â | taskloop  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | atomic  Â  Â  Â  Â  Â | taskloop simd  Â |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | atomic  Â  Â  Â  Â  Â | distribute  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // +------------------+-----------------+------------------------------------+<br>  Â // | target  Â  Â  Â  Â  Â | parallel  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | target  Â  Â  Â  Â  Â | for  Â  Â  Â  Â  Â  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>@@ -2071,6 +2094,7 @@ static bool CheckNestingOfRegions(Sema &<br>  Â // | target  Â  Â  Â  Â  Â | cancel  Â  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | target  Â  Â  Â  Â  Â | taskloop  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | target  Â  Â  Â  Â  Â | taskloop simd  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | target  Â  Â  Â  Â  Â | distribute  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // +------------------+-----------------+------------------------------------+<br>  Â // | teams  Â  Â  Â  Â  Â  | parallel  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | teams  Â  Â  Â  Â  Â  | for  Â  Â  Â  Â  Â  Â | +  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>@@ -2099,6 +2123,7 @@ static bool CheckNestingOfRegions(Sema &<br>  Â // | teams  Â  Â  Â  Â  Â  | cancel  Â  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | teams  Â  Â  Â  Â  Â  | taskloop  Â  Â  Â  | +  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | teams  Â  Â  Â  Â  Â  | taskloop simd  Â | +  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | teams  Â  Â  Â  Â  Â  | distribute  Â  Â  | !  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // +------------------+-----------------+------------------------------------+<br>  Â // | taskloop  Â  Â  Â  Â | parallel  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | taskloop  Â  Â  Â  Â | for  Â  Â  Â  Â  Â  Â | +  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>@@ -2126,6 +2151,7 @@ static bool CheckNestingOfRegions(Sema &<br>  Â // |  Â  Â  Â  Â  Â  Â  Â  Â  | point  Â  Â  Â  Â  Â |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | taskloop  Â  Â  Â  Â | cancel  Â  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | taskloop  Â  Â  Â  Â | taskloop  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | taskloop  Â  Â  Â  Â | distribute  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // +------------------+-----------------+------------------------------------+<br>  Â // | taskloop simd  Â  | parallel  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | taskloop simd  Â  | for  Â  Â  Â  Â  Â  Â |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>@@ -2154,6 +2180,36 @@ static bool CheckNestingOfRegions(Sema &<br>  Â // | taskloop simd  Â  | cancel  Â  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | taskloop simd  Â  | taskloop  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // | taskloop simd  Â  | taskloop simd  Â |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | taskloop simd  Â  | distribute  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // +------------------+-----------------+------------------------------------+<br>+  // | distribute  Â  Â  Â | parallel  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | for  Â  Â  Â  Â  Â  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | for simd  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | master  Â  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | critical  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | simd  Â  Â  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | sections  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | section  Â  Â  Â  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | single  Â  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | parallel for  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â |parallel for simd| *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â |parallel sections| *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | task  Â  Â  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | taskyield  Â  Â  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | barrier  Â  Â  Â  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | taskwait  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | taskgroup  Â  Â  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | flush  Â  Â  Â  Â  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | ordered  Â  Â  Â  Â | +  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | atomic  Â  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | target  Â  Â  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | teams  Â  Â  Â  Â  Â |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | cancellation  Â  | +  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // |  Â  Â  Â  Â  Â  Â  Â  Â  | point  Â  Â  Â  Â  Â |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | cancel  Â  Â  Â  Â  | +  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | taskloop  Â  Â  Â  | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | taskloop simd  Â | *  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>+  // | distribute  Â  Â  Â | distribute  Â  Â  |  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  |<br>  Â // +------------------+-----------------+------------------------------------+<br>  Â if (Stack->getCurScope()) {<br>  Â  Â auto ParentRegion = Stack->getParentDirective();<br>@@ -2163,7 +2219,8 @@ static bool CheckNestingOfRegions(Sema &<br>  Â  Â  Â NoRecommend,<br>  Â  Â  Â ShouldBeInParallelRegion,<br>  Â  Â  Â ShouldBeInOrderedRegion,<br>-  Â  Â  ShouldBeInTargetRegion<br>+  Â  Â  ShouldBeInTargetRegion,<br>+  Â  Â  ShouldBeInTeamsRegion<br>  Â  Â } Recommend = NoRecommend;<br>  Â  Â if (isOpenMPSimdDirective(ParentRegion) && CurrentRegion != OMPD_ordered) {<br>  Â  Â  Â // OpenMP [2.16, Nesting of Regions]<br>@@ -2303,10 +2360,17 @@ static bool CheckNestingOfRegions(Sema &<br>  Â  Â  Â // distribute, parallel, parallel sections, parallel workshare, and the<br>  Â  Â  Â // parallel loop and parallel loop SIMD constructs are the only OpenMP<br>  Â  Â  Â // constructs that can be closely nested in the teams region.<br>-  Â  Â  // TODO: add distribute directive.<br>-  Â  Â  NestingProhibited = !isOpenMPParallelDirective(CurrentRegion);<br>+  Â  Â  NestingProhibited = !isOpenMPParallelDirective(CurrentRegion) &&<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  !isOpenMPDistributeDirective(CurrentRegion);<br>  Â  Â  Â Recommend = ShouldBeInParallelRegion;<br>  Â  Â }<br>+  Â  if (!NestingProhibited && isOpenMPDistributeDirective(CurrentRegion)) {<br>+  Â  Â  // OpenMP 4.5 [2.17 Nesting of Regions]<br>+  Â  Â  // The region associated with the distribute construct must be strictly<br>+  Â  Â  // nested inside a teams region<br>+  Â  Â  NestingProhibited = !isOpenMPTeamsDirective(ParentRegion);<br>+  Â  Â  Recommend = ShouldBeInTeamsRegion;<br>+  Â  }<br>  Â  Â if (NestingProhibited) {<br>  Â  Â  Â SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region)<br>  Â  Â  Â  Â  Â << CloseNesting << getOpenMPDirectiveName(ParentRegion) << Recommend<br>@@ -2574,6 +2638,10 @@ StmtResult Sema::ActOnOpenMPExecutableDi<br>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  EndLoc, VarsWithInheritedDSA);<br>  Â  Â AllowedNameModifiers.push_back(OMPD_taskloop);<br>  Â  Â break;<br>+  case OMPD_distribute:<br>+  Â  Res = ActOnOpenMPDistributeDirective(ClausesWithImplicit, AStmt, StartLoc,<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â EndLoc, VarsWithInheritedDSA);<br>+  Â  break;<br>  Â case OMPD_threadprivate:<br>  Â  Â llvm_unreachable("OpenMP Directive is not allowed");<br>  Â case OMPD_unknown:<br>@@ -3402,7 +3470,8 @@ static bool CheckOpenMPIterationSpace(<br>  Â  Â  Â  Â  Â : OMPC_private;<br>  Â if (((isOpenMPSimdDirective(DKind) && DVar.CKind != OMPC_unknown &&<br>  Â  Â  Â  Â DVar.CKind != OMPC_threadprivate && DVar.CKind != PredeterminedCKind) ||<br>-  Â  Â  Â ((isOpenMPWorksharingDirective(DKind) || DKind == OMPD_taskloop) &&<br>+  Â  Â  Â ((isOpenMPWorksharingDirective(DKind) || DKind == OMPD_taskloop ||<br>+  Â  Â  Â  isOpenMPDistributeDirective(DKind)) &&<br>  Â  Â  Â  Â !isOpenMPSimdDirective(DKind) && DVar.CKind != OMPC_unknown &&<br>  Â  Â  Â  Â DVar.CKind != OMPC_private && DVar.CKind != OMPC_lastprivate &&<br>  Â  Â  Â  Â DVar.CKind != OMPC_threadprivate)) &&<br>@@ -3441,7 +3510,8 @@ static bool CheckOpenMPIterationSpace(<br>  Â ResultIterSpace.PreCond = ISC.BuildPreCond(DSA.getCurScope(), For->getCond());<br>  Â ResultIterSpace.NumIterations = ISC.BuildNumIterations(<br>  Â  Â  Â DSA.getCurScope(), (isOpenMPWorksharingDirective(DKind) ||<br>-  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  isOpenMPTaskLoopDirective(DKind)));<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  isOpenMPTaskLoopDirective(DKind) ||<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  isOpenMPDistributeDirective(DKind)));<br>  Â ResultIterSpace.CounterVar = ISC.BuildCounterVar();<br>  Â ResultIterSpace.PrivateCounterVar = ISC.BuildPrivateCounterVar();<br>  Â ResultIterSpace.CounterInit = ISC.BuildCounterInit();<br>@@ -3749,7 +3819,8 @@ CheckOpenMPLoop(OpenMPDirectiveKind DKin<br>  Â QualType VType = LastIteration.get()->getType();<br>  Â // Build variables passed into runtime, nesessary for worksharing directives.<br>  Â ExprResult LB, UB, IL, ST, EUB;<br>-  if (isOpenMPWorksharingDirective(DKind) || isOpenMPTaskLoopDirective(DKind)) {<br>+  if (isOpenMPWorksharingDirective(DKind) || isOpenMPTaskLoopDirective(DKind) ||<br>+  Â  Â  isOpenMPDistributeDirective(DKind)) {<br>  Â  Â // Lower bound variable, initialized with zero.<br>  Â  Â VarDecl *LBDecl = buildVarDecl(SemaRef, InitLoc, VType, ".</font><a href="http://omp.lb/" target="_blank"><u><font size="4" color="#0000FF">omp.lb</font></u></a><font size="4">");<br>  Â  Â LB = buildDeclRefExpr(SemaRef, LBDecl, VType, InitLoc);<br>@@ -3798,7 +3869,8 @@ CheckOpenMPLoop(OpenMPDirectiveKind DKin<br>  Â  Â VarDecl *IVDecl = buildVarDecl(SemaRef, InitLoc, VType, ".omp.iv");<br>  Â  Â IV = buildDeclRefExpr(SemaRef, IVDecl, VType, InitLoc);<br>  Â  Â Expr *RHS = (isOpenMPWorksharingDirective(DKind) ||<br>-  Â  Â  Â  Â  Â  Â  Â  Â isOpenMPTaskLoopDirective(DKind))<br>+  Â  Â  Â  Â  Â  Â  Â  Â isOpenMPTaskLoopDirective(DKind) ||<br>+  Â  Â  Â  Â  Â  Â  Â  Â isOpenMPDistributeDirective(DKind))<br>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â ? LB.get()<br>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â : SemaRef.ActOnIntegerConstant(SourceLocation(), 0).get();<br>  Â  Â Init = SemaRef.BuildBinOp(CurScope, InitLoc, BO_Assign, IV.get(), RHS);<br>@@ -3808,7 +3880,8 @@ CheckOpenMPLoop(OpenMPDirectiveKind DKin<br>  Â // Loop condition (IV < NumIterations) or (IV <= UB) for worksharing loops.<br>  Â SourceLocation CondLoc;<br>  Â ExprResult Cond =<br>-  Â  Â  (isOpenMPWorksharingDirective(DKind) || isOpenMPTaskLoopDirective(DKind))<br>+  Â  Â  (isOpenMPWorksharingDirective(DKind) ||<br>+  Â  Â  Â isOpenMPTaskLoopDirective(DKind) || isOpenMPDistributeDirective(DKind))<br>  Â  Â  Â  Â  Â ? SemaRef.BuildBinOp(CurScope, CondLoc, BO_LE, IV.get(), UB.get())<br>  Â  Â  Â  Â  Â : SemaRef.BuildBinOp(CurScope, CondLoc, BO_LT, IV.get(),<br>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  NumIterations.get());<br>@@ -3828,7 +3901,8 @@ CheckOpenMPLoop(OpenMPDirectiveKind DKin<br>  Â // Increments for worksharing loops (LB = LB + ST; UB = UB + ST).<br>  Â // Used for directives with static scheduling.<br>  Â ExprResult NextLB, NextUB;<br>-  if (isOpenMPWorksharingDirective(DKind) || isOpenMPTaskLoopDirective(DKind)) {<br>+  if (isOpenMPWorksharingDirective(DKind) || isOpenMPTaskLoopDirective(DKind) ||<br>+  Â  Â  isOpenMPDistributeDirective(DKind)) {<br>  Â  Â // LB + ST<br>  Â  Â NextLB = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, LB.get(), ST.get());<br>  Â  Â if (!NextLB.isUsable())<br>@@ -5345,6 +5419,32 @@ StmtResult Sema::ActOnOpenMPTaskLoopSimd<br>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â NestedLoopCount, Clauses, AStmt, B);<br> }<br><br>+StmtResult Sema::ActOnOpenMPDistributeDirective(<br>+  Â  ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,<br>+  Â  SourceLocation EndLoc,<br>+  Â  llvm::DenseMap<VarDecl *, Expr *> &VarsWithImplicitDSA) {<br>+  if (!AStmt)<br>+  Â  return StmtError();<br>+<br>+  assert(isa<CapturedStmt>(AStmt) && "Captured statement expected");<br>+  OMPLoopDirective::HelperExprs B;<br>+  // In presence of clause 'collapse' with number of loops, it will<br>+  // define the nested loops number.<br>+  unsigned NestedLoopCount =<br>+  Â  Â  CheckOpenMPLoop(OMPD_distribute, getCollapseNumberExpr(Clauses),<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  nullptr /*ordered not a clause on distribute*/, AStmt,<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  *this, *DSAStack, VarsWithImplicitDSA, B);<br>+  if (NestedLoopCount == 0)<br>+  Â  return StmtError();<br>+<br>+  assert((CurContext->isDependentContext() || B.builtAll()) &&<br>+  Â  Â  Â  Â "omp for loop exprs were not built");<br>+<br>+  getCurFunction()->setHasBranchProtectedScope();<br>+  return OMPDistributeDirective::Create(Context, StartLoc, EndLoc,<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  NestedLoopCount, Clauses, AStmt, B);<br>+}<br>+<br> OMPClause *Sema::ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr,<br>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  SourceLocation StartLoc,<br>  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  SourceLocation LParenLoc,<br>@@ -6381,6 +6481,49 @@ OMPClause *Sema::ActOnOpenMPFirstprivate<br>  Â  Â  Â  Â  Â continue;<br>  Â  Â  Â  Â }<br>  Â  Â  Â }<br>+<br>+  Â  Â  // OpenMP 4.5 [2.15.3.4, Restrictions, p.3]<br>+  Â  Â  // A list item that is private within a teams region must not appear in a<br>+  Â  Â  // firstprivate clause on a distribute construct if any of the distribute<br>+  Â  Â  // regions arising from the distribute construct ever bind to any of the<br>+  Â  Â  // teams regions arising from the teams construct.<br>+  Â  Â  // OpenMP 4.5 [2.15.3.4, Restrictions, p.3]<br>+  Â  Â  // A list item that appears in a reduction clause of a teams construct<br>+  Â  Â  // must not appear in a firstprivate clause on a distribute construct if<br>+  Â  Â  // any of the distribute regions arising from the distribute construct<br>+  Â  Â  // ever bind to any of the teams regions arising from the teams construct.<br>+  Â  Â  // OpenMP 4.5 [2.10.8, Distribute Construct, p.3]<br>+  Â  Â  // A list item may appear in a firstprivate or lastprivate clause but not<br>+  Â  Â  // both.<br>+  Â  Â  if (CurrDir == OMPD_distribute) {<br>+  Â  Â  Â  DVar = DSAStack->hasInnermostDSA(VD, MatchesAnyClause(OMPC_private),<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â [](OpenMPDirectiveKind K) -> bool {<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â return isOpenMPTeamsDirective(K);<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â },<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â false);<br>+  Â  Â  Â  if (DVar.CKind == OMPC_private && isOpenMPTeamsDirective(DVar.DKind)) {<br>+  Â  Â  Â  Â  Diag(ELoc, diag::err_omp_firstprivate_distribute_private_teams);<br>+  Â  Â  Â  Â  ReportOriginalDSA(*this, DSAStack, VD, DVar);<br>+  Â  Â  Â  Â  continue;<br>+  Â  Â  Â  }<br>+  Â  Â  Â  DVar = DSAStack->hasInnermostDSA(VD, MatchesAnyClause(OMPC_reduction),<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â [](OpenMPDirectiveKind K) -> bool {<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â return isOpenMPTeamsDirective(K);<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â },<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â false);<br>+  Â  Â  Â  if (DVar.CKind == OMPC_reduction &&<br>+  Â  Â  Â  Â  Â  isOpenMPTeamsDirective(DVar.DKind)) {<br>+  Â  Â  Â  Â  Diag(ELoc, diag::err_omp_firstprivate_distribute_in_teams_reduction);<br>+  Â  Â  Â  Â  ReportOriginalDSA(*this, DSAStack, VD, DVar);<br>+  Â  Â  Â  Â  continue;<br>+  Â  Â  Â  }<br>+  Â  Â  Â  DVar = DSAStack->getTopDSA(VD, false);<br>+  Â  Â  Â  if (DVar.CKind == OMPC_lastprivate) {<br>+  Â  Â  Â  Â  Diag(ELoc, diag::err_omp_firstprivate_and_lastprivate_in_distribute);<br>+  Â  Â  Â  Â  ReportOriginalDSA(*this, DSAStack, VD, DVar);<br>+  Â  Â  Â  Â  continue;<br>+  Â  Â  Â  }<br>+  Â  Â  }<br>  Â  Â }<br><br>  Â  Â // Variably modified types are not supported for tasks.<br>@@ -6577,6 +6720,18 @@ OMPClause *Sema::ActOnOpenMPLastprivateC<br>  Â  Â if (AssignmentOp.isInvalid())<br>  Â  Â  Â continue;<br><br>+  Â  // OpenMP 4.5 [2.10.8, Distribute Construct, p.3]<br>+  Â  // A list item may appear in a firstprivate or lastprivate clause but not<br>+  Â  // both.<br>+  Â  if (CurrDir == OMPD_distribute) {<br>+  Â  Â  DSAStackTy::DSAVarData DVar = DSAStack->getTopDSA(VD, false);<br>+  Â  Â  if (DVar.CKind == OMPC_firstprivate) {<br>+  Â  Â  Â  Diag(ELoc, diag::err_omp_firstprivate_and_lastprivate_in_distribute);<br>+  Â  Â  Â  ReportOriginalDSA(*this, DSAStack, VD, DVar);<br>+  Â  Â  Â  continue;<br>+  Â  Â  }<br>+  Â  }<br>+<br>  Â  Â if (TopDVar.CKind != OMPC_firstprivate)<br>  Â  Â  Â DSAStack->addDSA(VD, DE, OMPC_lastprivate);<br>  Â  Â Vars.push_back(DE);<br><br>Modified: cfe/trunk/lib/Sema/TreeTransform.h<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/lib/Sema/TreeTransform.h (original)<br>+++ cfe/trunk/lib/Sema/TreeTransform.h Mon Dec  7 22:21:03 2015<br>@@ -7386,6 +7386,17 @@ StmtResult TreeTransform<Derived>::Trans<br>  Â return Res;<br> }<br><br>+template <typename Derived><br>+StmtResult TreeTransform<Derived>::TransformOMPDistributeDirective(<br>+  Â  OMPDistributeDirective *D) {<br>+  DeclarationNameInfo DirName;<br>+  getDerived().getSema().StartOpenMPDSABlock(OMPD_distribute, DirName, nullptr,<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â D->getLocStart());<br>+  StmtResult Res = getDerived().TransformOMPExecutableDirective(D);<br>+  getDerived().getSema().EndOpenMPDSABlock(Res.get());<br>+  return Res;<br>+}<br>+<br> //===----------------------------------------------------------------------===//<br> // OpenMP clause transformation<br> //===----------------------------------------------------------------------===//<br><br>Modified: cfe/trunk/lib/Serialization/ASTReaderStmt.cpp<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/lib/Serialization/ASTReaderStmt.cpp (original)<br>+++ cfe/trunk/lib/Serialization/ASTReaderStmt.cpp Mon Dec  7 22:21:03 2015<br>@@ -2441,6 +2441,10 @@ void ASTStmtReader::VisitOMPTaskLoopSimd<br>  Â VisitOMPLoopDirective(D);<br> }<br><br>+void ASTStmtReader::VisitOMPDistributeDirective(OMPDistributeDirective *D) {<br>+  VisitOMPLoopDirective(D);<br>+}<br>+<br> //===----------------------------------------------------------------------===//<br> // ASTReader Implementation<br> //===----------------------------------------------------------------------===//<br>@@ -3079,6 +3083,14 @@ Stmt *ASTReader::ReadStmtFromStream(Modu<br>  Â  Â  Â break;<br>  Â  Â }<br><br>+  Â  case STMT_OMP_DISTRIBUTE_DIRECTIVE: {<br>+  Â  Â  unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];<br>+  Â  Â  unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];<br>+  Â  Â  S = OMPDistributeDirective::CreateEmpty(Context, NumClauses, CollapsedNum,<br>+  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Empty);<br>+  Â  Â  break;<br>+  Â  }<br>+<br>  Â  Â case EXPR_CXX_OPERATOR_CALL:<br>  Â  Â  Â S = new (Context) CXXOperatorCallExpr(Context, Empty);<br>  Â  Â  Â break;<br><br>Modified: cfe/trunk/lib/Serialization/ASTWriterStmt.cpp<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/lib/Serialization/ASTWriterStmt.cpp (original)<br>+++ cfe/trunk/lib/Serialization/ASTWriterStmt.cpp Mon Dec  7 22:21:03 2015<br>@@ -2261,6 +2261,11 @@ void ASTStmtWriter::VisitOMPTaskLoopSimd<br>  Â Code = serialization::STMT_OMP_TASKLOOP_SIMD_DIRECTIVE;<br> }<br><br>+void ASTStmtWriter::VisitOMPDistributeDirective(OMPDistributeDirective *D) {<br>+  VisitOMPLoopDirective(D);<br>+  Code = serialization::STMT_OMP_DISTRIBUTE_DIRECTIVE;<br>+}<br>+<br> //===----------------------------------------------------------------------===//<br> // ASTWriter Implementation<br> //===----------------------------------------------------------------------===//<br><br>Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp<br>URL: </font><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><u><font size="4" color="#0000FF">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=255001&r1=255000&r2=255001&view=diff</font></u></a><font size="4"><br>==============================================================================<br>--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp (original)<br>+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp Mon Dec  7 22:21:03 2015<br>@@ -831,6 +831,7 @@ void ExprEngine::Visit(const Stmt *S, Ex<br>  Â  Â case Stmt::OMPCancelDirectiveClass:<br>  Â  Â case Stmt::OMPTaskLoopDirectiveClass:<br>  Â  Â case Stmt::OMPTaskLoopSimdDirectiveClass:<br>+  Â  case Stmt::OMPDist</font><br><font size="4"><br>_______________________________________________<br>cfe-commits mailing list</font><u><font size="4" color="#0000FF"><br></font></u><a href="mailto:cfe-commits@lists.llvm.org" target="_blank"><u><font size="4" color="#0000FF">cfe-commits@lists.llvm.org</font></u></a><u><font size="4" color="#0000FF"><br></font></u><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" target="_blank"><u><font size="4" color="#0000FF">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</font></u></a><font size="4"><br></font></ul><font size="4"><br></font><br><br><font size="4">-- </font><br><font size="4">Alexey Samsonov</font><u><font size="4" color="#0000FF"><br></font></u><a href="mailto:vonosmas@gmail.com" target="_blank"><u><font size="4" color="#0000FF">vonosmas@gmail.com</font></u></a><br><br><br>
</div></div><p></p></div>
<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div></div></div></div>