<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.E-MailFormatvorlage18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:1352026620;
        mso-list-template-ids:73706068;}
@list l0:level1
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:36.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Symbol;}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:72.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:"Courier New";
        mso-bidi-font-family:"Times New Roman";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:108.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:144.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:180.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:216.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:252.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:288.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:;
        mso-level-tab-stop:324.0pt;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=DE link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Yep, that’s the error and I think I have found the problem’s cause and a solution:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>isOpenMPDistributeDirective() has to be added to getArraysOffset() in AST/StmtOpenMP.h (see attached git diff)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Otherwise numLoopChildren() reports too less children which results in too less memory being allocated in AST/StmtOpenMP.cpp.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>My local ASan build confirms that now everything should be fine whereas it previously showed the same error as the build bot.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>As I don’t have commit access, feel free to commit if found suitable ;-)<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Cheers<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Jonas<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> cfe-commits [mailto:cfe-commits-bounces@lists.llvm.org] <b>On Behalf Of </b>NAKAMURA Takumi via cfe-commits<br><b>Sent:</b> Wednesday, December 09, 2015 9:08 AM<br><b>To:</b> Hans Wennborg; Carlo Bertolli<br><b>Cc:</b> cfe-commits<br><b>Subject:</b> Re: r255001 - Add parse and sema for OpenMP distribute directive and all its clauses excluding dist_schedule.<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><div><p class=MsoNormal>Reverted in r255094.<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>I suspect, in StmtOpenMP.h, "*std::next(begin_iter, n) = Expr" would be always safe.<o:p></o:p></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>On Wed, Dec 9, 2015 at 7:19 AM Hans Wennborg via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<o:p></o:p></p></div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm'><div><p class=MsoNormal>It fails on Windows too. I was using a 32-bit build on Windows with -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON.<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>If you need more time for fixing this, please consider reverting it in the meantime.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Thanks,<o:p></o:p></p></div><div><p class=MsoNormal>Hans<o:p></o:p></p></div></div><div><div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>On Tue, Dec 8, 2015 at 12:58 PM, Carlo Bertolli via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<o:p></o:p></p><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 border=0 width=16 height=16 id="_x0000_i1033" src="cid:2__=8FBBF586DFFD6C738f9e8a93df938690918c8FB@" alt="Inactive hide details for Alexey Samsonov ---12/08/2015 12:36:39 PM---ASan bootstrap provides an error report as well: http://l"><span style='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></span><br><br><span style='font-size:10.0pt;color:#5F5F5F'>From: </span><span style='font-size:10.0pt'>Alexey Samsonov <<a href="mailto:vonosmas@gmail.com" target="_blank">vonosmas@gmail.com</a>></span><br><span style='font-size:10.0pt;color:#5F5F5F'>To: </span><span style='font-size:10.0pt'>NAKAMURA Takumi <<a href="mailto:geek4civic@gmail.com" target="_blank">geek4civic@gmail.com</a>></span><br><span style='font-size:10.0pt;color:#5F5F5F'>Cc: </span><span style='font-size:10.0pt'>Carlo Bertolli/Watson/IBM@IBMUS, cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span><br><span style='font-size:10.0pt;color:#5F5F5F'>Date: </span><span style='font-size:10.0pt'>12/08/2015 12:36 PM</span><br><span style='font-size:10.0pt;color:#5F5F5F'>Subject: </span><span style='font-size:10.0pt'>Re: r255001 - Add parse and sema for OpenMP distribute directive and all its clauses excluding dist_schedule.</span><o:p></o:p></p><div class=MsoNormal><hr size=2 width="100%" noshade style='color:#8091A5' align=left></div><div><div><p class=MsoNormal><br><br><br><span style='font-size:13.5pt'>ASan bootstrap provides an error report as well:</span><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"><span style='font-size:13.5pt'>http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/8407/steps/check-clang%20asan/logs/stdio</span></a><br><span style='font-size:13.5pt'>Please investigate or revert.</span><br><br><span style='font-size:13.5pt'>On Tue, Dec 8, 2015 at 6:06 AM, NAKAMURA Takumi via cfe-commits <</span><a href="mailto:cfe-commits@lists.llvm.org" target="_blank"><span style='font-size:13.5pt'>cfe-commits@lists.llvm.org</span></a><span style='font-size:13.5pt'>> wrote:</span><o:p></o:p></p><p class=MsoNormal style='margin-left:36.0pt'><span style='font-size:13.5pt'>It crashes on i686-clang. See </span><a href="http://bb.pgr.jp/builders/clang-3stage-i686-linux/builds/4055" target="_blank"><span style='font-size:13.5pt'>http://bb.pgr.jp/builders/clang-3stage-i686-linux/builds/4055</span></a><br><span style='font-size:13.5pt'>Investigating.</span><br><br><span style='font-size:13.5pt'>#6  0xf7ea482f in operator delete(void*) () from /usr/lib32/libstdc++.so.6</span><br><span style='font-size:13.5pt'>#7  0x0bef8cce in llvm::DenseMap<clang::VarDecl*, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<clang::VarDecl*>, llvm::detail::DenseSetPair<clang::VarDecl*> >::~DenseMap (this=0xf2419d8)</span><br><span style='font-size:13.5pt'>    at llvm/include/llvm/ADT/DenseMap.h:575</span><br><span style='font-size:13.5pt'>#8  0x0bef8c86 in llvm::DenseSet<clang::VarDecl*, llvm::DenseMapInfo<clang::VarDecl*> >::~DenseSet (this=0xf2419d8)</span><br><span style='font-size:13.5pt'>    at llvm/include/llvm/ADT/DenseSet.h:39</span><br><span style='font-size:13.5pt'>#9  0x0cf988a4 in (anonymous namespace)::DSAStackTy::SharingMapTy::~SharingMapTy (this=0xf2412c0)</span><br><span style='font-size:13.5pt'>    at clang/lib/Sema/SemaOpenMP.cpp:95</span><br><span style='font-size:13.5pt'>#10 0x0cf9e24b in llvm::SmallVectorTemplateBase<(anonymous namespace)::DSAStackTy::SharingMapTy, false>::pop_back (this=0xf23fca0)</span><br><span style='font-size:13.5pt'>    at llvm/include/llvm/ADT/SmallVector.h:245</span><br><span style='font-size:13.5pt'>#11 0x0cf68ed2 in (anonymous namespace)::DSAStackTy::pop (this=0xf23fca0)</span><br><span style='font-size:13.5pt'>    at clang/lib/Sema/SemaOpenMP.cpp:163</span><br><span style='font-size:13.5pt'>#12 0x0cf68a50 in clang::Sema::EndOpenMPDSABlock (this=0xf23e188,</span><br><span style='font-size:13.5pt'>    CurDirective=0xf2901a0)</span><br><span style='font-size:13.5pt'>    at clang/lib/Sema/SemaOpenMP.cpp:957</span><br><span style='font-size:13.5pt'>#13 0x0c603bf0 in clang::Parser::ParseOpenMPDeclarativeOrExecutableDirective (</span><br><span style='font-size:13.5pt'>    this=0xf25d3c0, StandAloneAllowed=false)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/ParseOpenMP.cpp:314</span><br><span style='font-size:13.5pt'>#14 0x0c61c641 in clang::Parser::ParseStatementOrDeclarationAfterAttributes (</span><br><span style='font-size:13.5pt'>    this=0xf25d3c0, Stmts=..., OnlyStatement=true, TrailingElseLoc=0x0,</span><br><span style='font-size:13.5pt'>    Attrs=...)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/ParseStmt.cpp:349</span><br><span style='font-size:13.5pt'>#15 0x0c61b1e9 in clang::Parser::ParseStatementOrDeclaration (this=0xf25d3c0,</span><br><span style='font-size:13.5pt'>    Stmts=..., OnlyStatement=true, TrailingElseLoc=0x0)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/ParseStmt.cpp:106</span><br><span style='font-size:13.5pt'>#16 0x0c61b064 in clang::Parser::ParseStatement (this=0xf25d3c0,</span><br><span style='font-size:13.5pt'>    TrailingElseLoc=0x0)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/ParseStmt.cpp:42</span><br><span style='font-size:13.5pt'>#17 0x0c6039ff in clang::Parser::ParseOpenMPDeclarativeOrExecutableDirective (</span><br><span style='font-size:13.5pt'>    this=0xf25d3c0, StandAloneAllowed=false)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/ParseOpenMP.cpp:305</span><br><span style='font-size:13.5pt'>#18 0x0c61c641 in clang::Parser::ParseStatementOrDeclarationAfterAttributes (</span><br><span style='font-size:13.5pt'>    this=0xf25d3c0, Stmts=..., OnlyStatement=true, TrailingElseLoc=0x0,</span><br><span style='font-size:13.5pt'>    Attrs=...)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/ParseStmt.cpp:349</span><br><span style='font-size:13.5pt'>#19 0x0c61b1e9 in clang::Parser::ParseStatementOrDeclaration (this=0xf25d3c0,</span><br><span style='font-size:13.5pt'>    Stmts=..., OnlyStatement=true, TrailingElseLoc=0x0)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/ParseStmt.cpp:106</span><br><span style='font-size:13.5pt'>#20 0x0c61b064 in clang::Parser::ParseStatement (this=0xf25d3c0,</span><br><span style='font-size:13.5pt'>    TrailingElseLoc=0x0)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/ParseStmt.cpp:42</span><br><span style='font-size:13.5pt'>#21 0x0c6039ff in clang::Parser::ParseOpenMPDeclarativeOrExecutableDirective (</span><br><span style='font-size:13.5pt'>    this=0xf25d3c0, StandAloneAllowed=true)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/ParseOpenMP.cpp:305</span><br><span style='font-size:13.5pt'>#22 0x0c61c641 in clang::Parser::ParseStatementOrDeclarationAfterAttributes (</span><br><span style='font-size:13.5pt'>    this=0xf25d3c0, Stmts=..., OnlyStatement=false, TrailingElseLoc=0x0,</span><br><span style='font-size:13.5pt'>    Attrs=...)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/ParseStmt.cpp:349</span><br><span style='font-size:13.5pt'>#23 0x0c61b1e9 in clang::Parser::ParseStatementOrDeclaration (this=0xf25d3c0,</span><br><span style='font-size:13.5pt'>    Stmts=..., OnlyStatement=false, TrailingElseLoc=0x0)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/ParseStmt.cpp:106</span><br><span style='font-size:13.5pt'>#24 0x0c625955 in clang::Parser::ParseCompoundStatementBody (this=0xf25d3c0,</span><br><span style='font-size:13.5pt'>    isStmtExpr=false)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/ParseStmt.cpp:968</span><br><span style='font-size:13.5pt'>#25 0x0c62692d in clang::Parser::ParseFunctionStatementBody (this=0xf25d3c0,</span><br><span style='font-size:13.5pt'>    Decl=0xf27a948, BodyScope=...)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/ParseStmt.cpp:1914</span><br><span style='font-size:13.5pt'>#26 0x0c53f639 in clang::Parser::ParseFunctionDefinition (this=0xf25d3c0,</span><br><span style='font-size:13.5pt'>    D=..., TemplateInfo=..., LateParsedAttrs=0xffffb630)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/Parser.cpp:1147</span><br><span style='font-size:13.5pt'>#27 0x0c56c1ca in clang::Parser::ParseDeclGroup (this=0xf25d3c0, DS=...,</span><br><span style='font-size:13.5pt'>    Context=0, DeclEnd=0x0, FRI=0x0)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/ParseDecl.cpp:1757</span><br><span style='font-size:13.5pt'>#28 0x0c53e13b in clang::Parser::ParseDeclOrFunctionDefInternal (</span><br><span style='font-size:13.5pt'>    this=0xf25d3c0, attrs=..., DS=..., AS=clang::AS_none)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/Parser.cpp:927</span><br><span style='font-size:13.5pt'>#29 0x0c53d527 in clang::Parser::ParseDeclarationOrFunctionDefinition (</span><br><span style='font-size:13.5pt'>    this=0xf25d3c0, attrs=..., DS=0x0, AS=clang::AS_none)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/Parser.cpp:943</span><br><span style='font-size:13.5pt'>#30 0x0c53c9c4 in clang::Parser::ParseExternalDeclaration (this=0xf25d3c0,</span><br><span style='font-size:13.5pt'>    attrs=..., DS=0x0)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/Parser.cpp:801</span><br><span style='font-size:13.5pt'>#31 0x0c53b4af in clang::Parser::ParseTopLevelDecl (this=0xf25d3c0, Result=...)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/Parser.cpp:593</span><br><span style='font-size:13.5pt'>#32 0x0c535b0d in clang::ParseAST (S=..., PrintStats=false,</span><br><span style='font-size:13.5pt'>    SkipFunctionBodies=false)</span><br><span style='font-size:13.5pt'>    at clang/lib/Parse/ParseAST.cpp:161</span><br><span style='font-size:13.5pt'>#33 0x0b3bec76 in clang::ASTFrontendAction::ExecuteAction (this=0xf200980)</span><br><span style='font-size:13.5pt'>    at clang/lib/Frontend/FrontendAction.cpp:538</span><br><span style='font-size:13.5pt'>#34 0x0b3be581 in clang::FrontendAction::Execute (this=0xf200980)</span><br><span style='font-size:13.5pt'>    at clang/lib/Frontend/FrontendAction.cpp:439</span><br><span style='font-size:13.5pt'>#35 0x0b355071 in clang::CompilerInstance::ExecuteAction (this=0xf1ff128,</span><br><span style='font-size:13.5pt'>    Act=...)</span><br><span style='font-size:13.5pt'>    at clang/lib/Frontend/CompilerInstance.cpp:841</span><br><span style='font-size:13.5pt'>#36 0x0b52d118 in clang::ExecuteCompilerInvocation (Clang=0xf1ff128)</span><br><span style='font-size:13.5pt'>    at clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:222</span><br><span style='font-size:13.5pt'>#37 0x086e8734 in cc1_main (Argv=...,</span><br><span style='font-size:13.5pt'>    Argv0=0xffffd7c0 "/home/tnakamura/llvm/2-32/bin/clang",</span><br><span style='font-size:13.5pt'>    MainAddr=0x86d7820 <GetExecutablePath(char const*, bool)>)</span><br><span style='font-size:13.5pt'>    at clang/tools/driver/cc1_main.cpp:116</span><br><span style='font-size:13.5pt'>#38 0x086d9823 in ExecuteCC1Tool (argv=..., Tool=...)</span><br><span style='font-size:13.5pt'>    at clang/tools/driver/driver.cpp:301</span><br><span style='font-size:13.5pt'>#39 0x086d8316 in main (argc_=8, argv_=0xffffd684)</span><br><span style='font-size:13.5pt'>    at clang/tools/driver/driver.cpp:366</span><br><br><br><span style='font-size:13.5pt'>On Tue, Dec 8, 2015 at 1:24 PM Carlo Bertolli via cfe-commits <</span><a href="mailto:cfe-commits@lists.llvm.org" target="_blank"><span style='font-size:13.5pt'>cfe-commits@lists.llvm.org</span></a><span style='font-size:13.5pt'>> wrote:</span><br><span style='font-size:13.5pt'>Author: cbertol<br>Date: Mon Dec  7 22:21:03 2015<br>New Revision: 255001<br><br>URL: </span><a href="http://llvm.org/viewvc/llvm-project?rev=255001&view=rev" target="_blank"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project?rev=255001&view=rev</span></a><span style='font-size:13.5pt'><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: </span><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"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><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"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><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"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtOpenMP.h?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><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"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><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"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><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"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.h?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><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"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/StmtNodes.td?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><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"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><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"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtOpenMP.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtOpenMP.cpp?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtPrinter.cpp?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/OpenMPKinds.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/OpenMPKinds.cpp?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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   | *                                  |</span><br><span style='font-size:13.5pt'>+  // | 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, ".</span><a href="http://omp.lb/" target="_blank"><span style='font-size:13.5pt'>omp.lb</span></a><span style='font-size:13.5pt'>");<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: </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderStmt.cpp?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=255001&r1=255000&r2=255001&view=diff" target="_blank"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterStmt.cpp?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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: </span><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"><span style='font-size:13.5pt'>http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=255001&r1=255000&r2=255001&view=diff</span></a><span style='font-size:13.5pt'><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</span><br><span style='font-size:13.5pt'><br>_______________________________________________<br>cfe-commits mailing list<u><span style='color:blue'><br></span></u></span><a href="mailto:cfe-commits@lists.llvm.org" target="_blank"><span style='font-size:13.5pt'>cfe-commits@lists.llvm.org</span></a><u><span style='font-size:13.5pt;color:blue'><br></span></u><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" target="_blank"><span style='font-size:13.5pt'>http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</span></a><o:p></o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'><span style='font-size:13.5pt'><br></span><br><br><span style='font-size:13.5pt'>-- </span><br><span style='font-size:13.5pt'>Alexey Samsonov<u><span style='color:blue'><br></span></u></span><a href="mailto:vonosmas@gmail.com" target="_blank"><span style='font-size:13.5pt'>vonosmas@gmail.com</span></a><br><br><o:p></o:p></p></div></div></div><p class=MsoNormal style='margin-bottom:12.0pt'><br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p></div></div></div></div><p class=MsoNormal>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><o:p></o:p></p></blockquote></div></div></div></body></html>