r341766 - [OpenMP] Add support for nested 'declare target' directives
Author: kli Date: Sun Sep 9 19:07:09 2018 New Revision: 341766 URL: http://llvm.org/viewvc/llvm-project?rev=341766&view=rev Log: [OpenMP] Add support for nested 'declare target' directives Add the capability to nest multiple declare target directives - including header files within a declare target region. Differential Revision: https://reviews.llvm.org/D51378 Patch by Patrick Lyster Added: cfe/trunk/test/OpenMP/Inputs/ cfe/trunk/test/OpenMP/Inputs/declare_target_include.h Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/Parse/ParseOpenMP.cpp cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/test/OpenMP/declare_target_ast_print.cpp cfe/trunk/test/OpenMP/declare_target_messages.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=341766&r1=341765&r2=341766&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Sun Sep 9 19:07:09 2018 @@ -8783,8 +8783,6 @@ def warn_omp_linear_step_zero : Warning< def warn_omp_alignment_not_power_of_two : Warning< "aligned clause will be ignored because the requested alignment is not a power of 2">, InGroup; -def err_omp_enclosed_declare_target : Error< - "declare target region may not be enclosed within another declare target region">; def err_omp_invalid_target_decl : Error< "%0 used in declare target directive is not a variable or a function name">; def err_omp_declare_target_multiple : Error< Modified: cfe/trunk/include/clang/Sema/Sema.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=341766&r1=341765&r2=341766&view=diff == --- cfe/trunk/include/clang/Sema/Sema.h (original) +++ cfe/trunk/include/clang/Sema/Sema.h Sun Sep 9 19:07:09 2018 @@ -8601,8 +8601,8 @@ public: // private: void *VarDataSharingAttributesStack; - /// Set to true inside '#pragma omp declare target' region. - bool IsInOpenMPDeclareTargetContext = false; + /// Number of nested '#pragma omp declare target' directives. + unsigned DeclareTargetNestingLevel = 0; /// Initialization of data-sharing attributes stack. void InitDataSharingAttributesStack(); void DestroyDataSharingAttributesStack(); @@ -8736,7 +8736,7 @@ public: SourceLocation IdLoc = SourceLocation()); /// Return true inside OpenMP declare target region. bool isInOpenMPDeclareTargetContext() const { -return IsInOpenMPDeclareTargetContext; +return DeclareTargetNestingLevel > 0; } /// Return true inside OpenMP target region. bool isInOpenMPTargetExecutionDirective() const; Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=341766&r1=341765&r2=341766&view=diff == --- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original) +++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Sun Sep 9 19:07:09 2018 @@ -775,8 +775,8 @@ Parser::DeclGroupPtrTy Parser::ParseOpen llvm::SmallVector Decls; DKind = parseOpenMPDirectiveKind(*this); -while (DKind != OMPD_end_declare_target && DKind != OMPD_declare_target && - Tok.isNot(tok::eof) && Tok.isNot(tok::r_brace)) { +while (DKind != OMPD_end_declare_target && Tok.isNot(tok::eof) && + Tok.isNot(tok::r_brace)) { DeclGroupPtrTy Ptr; // Here we expect to see some function declaration. if (AS == AS_none) { Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=341766&r1=341765&r2=341766&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Sun Sep 9 19:07:09 2018 @@ -12960,19 +12960,14 @@ bool Sema::ActOnStartOpenMPDeclareTarget Diag(Loc, diag::err_omp_region_not_file_context); return false; } - if (IsInOpenMPDeclareTargetContext) { -Diag(Loc, diag::err_omp_enclosed_declare_target); -return false; - } - - IsInOpenMPDeclareTargetContext = true; + ++DeclareTargetNestingLevel; return true; } void Sema::ActOnFinishOpenMPDeclareTargetDirective() { - assert(IsInOpenMPDeclareTargetContext && + assert(DeclareTargetNestingLevel > 0 && "Unexpected ActOnFinishOpenMPDeclareTargetDirective"); - IsInOpenMPDeclareTargetContext = false; + --DeclareTargetNestingLevel; } void Sema::ActOnOpenMPDeclareTargetName(Scope *CurScope, Added: cfe/trunk/test/OpenMP/Inputs/declare_target_include.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/O
r351580 - [OPENMP][DOCS] Release notes/OpenMP support updates, NFC.
Author: kli Date: Fri Jan 18 11:57:37 2019 New Revision: 351580 URL: http://llvm.org/viewvc/llvm-project?rev=351580&view=rev Log: [OPENMP][DOCS] Release notes/OpenMP support updates, NFC. Differential Revision: https://reviews.llvm.org/D56733 Modified: cfe/trunk/docs/OpenMPSupport.rst cfe/trunk/docs/ReleaseNotes.rst Modified: cfe/trunk/docs/OpenMPSupport.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/OpenMPSupport.rst?rev=351580&r1=351579&r2=351580&view=diff == --- cfe/trunk/docs/OpenMPSupport.rst (original) +++ cfe/trunk/docs/OpenMPSupport.rst Fri Jan 18 11:57:37 2019 @@ -17,60 +17,50 @@ OpenMP Support == -Clang fully supports OpenMP 4.5. Clang supports offloading to X86_64, AArch64, -PPC64[LE] and has `basic support for Cuda devices`_. - -Standalone directives -= - -* #pragma omp [for] simd: :good:`Complete`. - -* #pragma omp declare simd: :partial:`Partial`. We support parsing/semantic - analysis + generation of special attributes for X86 target, but still - missing the LLVM pass for vectorization. - -* #pragma omp taskloop [simd]: :good:`Complete`. - -* #pragma omp target [enter|exit] data: :good:`Complete`. - -* #pragma omp target update: :good:`Complete`. - -* #pragma omp target: :good:`Complete`. +Clang supports the following OpenMP 5.0 features -* #pragma omp declare target: :good:`Complete`. +* The `reduction`-based clauses in the `task` and `target`-based directives. -* #pragma omp teams: :good:`Complete`. +* Support relational-op != (not-equal) as one of the canonical forms of random + access iterator. -* #pragma omp distribute [simd]: :good:`Complete`. +* Support for mapping of the lambdas in target regions. -* #pragma omp distribute parallel for [simd]: :good:`Complete`. +* Parsing/sema analysis for the requires directive. -Combined directives -=== +* Nested declare target directives. -* #pragma omp parallel for simd: :good:`Complete`. +* Make the `this` pointer implicitly mapped as `map(this[:1])`. -* #pragma omp target parallel: :good:`Complete`. +* The `close` *map-type-modifier*. -* #pragma omp target parallel for [simd]: :good:`Complete`. - -* #pragma omp target simd: :good:`Complete`. - -* #pragma omp target teams: :good:`Complete`. - -* #pragma omp teams distribute [simd]: :good:`Complete`. - -* #pragma omp target teams distribute [simd]: :good:`Complete`. - -* #pragma omp teams distribute parallel for [simd]: :good:`Complete`. - -* #pragma omp target teams distribute parallel for [simd]: :good:`Complete`. +Clang fully supports OpenMP 4.5. Clang supports offloading to X86_64, AArch64, +PPC64[LE] and has `basic support for Cuda devices`_. -Clang does not support any constructs/updates from OpenMP 5.0 except -for `reduction`-based clauses in the `task` and `target`-based directives. +* #pragma omp declare simd: :partial:`Partial`. We support parsing/semantic + analysis + generation of special attributes for X86 target, but still + missing the LLVM pass for vectorization. In addition, the LLVM OpenMP runtime `libomp` supports the OpenMP Tools -Interface (OMPT) on x86, x86_64, AArch64, and PPC64 on Linux, Windows, and mac OS. +Interface (OMPT) on x86, x86_64, AArch64, and PPC64 on Linux, Windows, and macOS. + +General improvements + +- New collapse clause scheme to avoid expensive remainder operations. + Compute loop index variables after collapsing a loop nest via the + collapse clause by replacing the expensive remainder operation with + multiplications and additions. + +- The default schedules for the `distribute` and `for` constructs in a + parallel region and in SPMD mode have changed to ensure coalesced + accesses. For the `distribute` construct, a static schedule is used + with a chunk size equal to the number of threads per team (default + value of threads or as specified by the `thread_limit` clause if + present). For the `for` construct, the schedule is static with chunk + size of one. + +- Simplified SPMD code generation for `distribute parallel for` when + the new default schedules are applicable. .. _basic support for Cuda devices: Modified: cfe/trunk/docs/ReleaseNotes.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=351580&r1=351579&r2=351580&view=diff == --- cfe/trunk/docs/ReleaseNotes.rst (original) +++ cfe/trunk/docs/ReleaseNotes.rst Fri Jan 18 11:57:37 2019 @@ -133,7 +133,36 @@ ABI Changes in Clang OpenMP Support in Clang -- -- ... +- OpenMP 5.0 features + + - Support relational-op != (not-equal) as one of the canonical forms of random +access iterator. + - Added support for mapping of the lambdas in target regions. + - Added parsing/sema analysis for the requires directive. + - Support nested declar
r347405 - [OPENMP] Support relational-op != (not-equal) as one of the canonical
Author: kli Date: Wed Nov 21 11:10:48 2018 New Revision: 347405 URL: http://llvm.org/viewvc/llvm-project?rev=347405&view=rev Log: [OPENMP] Support relational-op != (not-equal) as one of the canonical forms of random access iterator In OpenMP 4.5, only 4 relational operators are supported: <, <=, >, and >=. This work is to enable support for relational operator != (not-equal) as one of the canonical forms. Patch by Anh Tuyen Tran Differential Revision: https://reviews.llvm.org/D54441 Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/test/OpenMP/distribute_parallel_for_simd_loop_messages.cpp cfe/trunk/test/OpenMP/distribute_simd_loop_messages.cpp cfe/trunk/test/OpenMP/for_loop_messages.cpp cfe/trunk/test/OpenMP/for_simd_loop_messages.cpp cfe/trunk/test/OpenMP/parallel_for_ast_print.cpp cfe/trunk/test/OpenMP/parallel_for_codegen.cpp cfe/trunk/test/OpenMP/parallel_for_loop_messages.cpp cfe/trunk/test/OpenMP/parallel_for_simd_loop_messages.cpp cfe/trunk/test/OpenMP/simd_loop_messages.cpp cfe/trunk/test/OpenMP/target_parallel_for_loop_messages.cpp cfe/trunk/test/OpenMP/target_parallel_for_simd_loop_messages.cpp cfe/trunk/test/OpenMP/target_simd_loop_messages.cpp cfe/trunk/test/OpenMP/target_teams_distribute_loop_messages.cpp cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_loop_messages.cpp cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_simd_loop_messages.cpp cfe/trunk/test/OpenMP/target_teams_distribute_simd_loop_messages.cpp cfe/trunk/test/OpenMP/taskloop_loop_messages.cpp cfe/trunk/test/OpenMP/taskloop_simd_loop_messages.cpp cfe/trunk/test/OpenMP/teams_distribute_loop_messages.cpp cfe/trunk/test/OpenMP/teams_distribute_parallel_for_loop_messages.cpp cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_loop_messages.cpp cfe/trunk/test/OpenMP/teams_distribute_simd_loop_messages.cpp Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=347405&r1=347404&r2=347405&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Wed Nov 21 11:10:48 2018 @@ -3905,7 +3905,8 @@ class OpenMPIterationSpaceChecker { /// Var <= UB /// UB > Var /// UB >= Var - bool TestIsLessOp = false; + /// This will have no value when the condition is != + llvm::Optional TestIsLessOp; /// This flag is true when condition is strict ( < or > ). bool TestIsStrictOp = false; /// This flag is true when step is subtracted on each iteration. @@ -3971,8 +3972,8 @@ private: /// Helper to set loop counter variable and its initializer. bool setLCDeclAndLB(ValueDecl *NewLCDecl, Expr *NewDeclRefExpr, Expr *NewLB); /// Helper to set upper bound. - bool setUB(Expr *NewUB, bool LessOp, bool StrictOp, SourceRange SR, - SourceLocation SL); + bool setUB(Expr *NewUB, llvm::Optional LessOp, bool StrictOp, + SourceRange SR, SourceLocation SL); /// Helper to set loop increment. bool setStep(Expr *NewStep, bool Subtract); }; @@ -4007,15 +4008,17 @@ bool OpenMPIterationSpaceChecker::setLCD return false; } -bool OpenMPIterationSpaceChecker::setUB(Expr *NewUB, bool LessOp, bool StrictOp, -SourceRange SR, SourceLocation SL) { +bool OpenMPIterationSpaceChecker::setUB(Expr *NewUB, llvm::Optional LessOp, +bool StrictOp, SourceRange SR, +SourceLocation SL) { // State consistency checking to ensure correct usage. assert(LCDecl != nullptr && LB != nullptr && UB == nullptr && Step == nullptr && !TestIsLessOp && !TestIsStrictOp); if (!NewUB) return true; UB = NewUB; - TestIsLessOp = LessOp; + if (LessOp) +TestIsLessOp = LessOp; TestIsStrictOp = StrictOp; ConditionSrcRange = SR; ConditionLoc = SL; @@ -4055,18 +4058,23 @@ bool OpenMPIterationSpaceChecker::setSte bool IsConstPos = IsConstant && Result.isSigned() && (Subtract == Result.isNegative()); bool IsConstZero = IsConstant && !Result.getBoolValue(); + +// != with increment is treated as <; != with decrement is treated as > +if (!TestIsLessOp.hasValue()) + TestIsLessOp = IsConstPos || (IsUnsigned && !Subtract); if (UB && (IsConstZero || - (TestIsLessOp ? (IsConstNeg || (IsUnsigned && Subtract)) - : (IsConstPos || (IsUnsigned && !Subtract) { + (TestIsLessOp.getValue() ? + (IsConstNeg || (IsUnsigned && Subtract)) : + (IsConstPos || (IsUnsigned && !Subtract) { SemaRef.Diag(NewStep->getExprLoc(), diag::err_omp_loop_incr_not_compatible) - << LCDecl << TestIsLessOp << NewStep->getSourceRange(); +
r347408 - [OPENMP] remove redundant MapTypeModifierSpecified flag in ParseOpenMP.cpp (NFC)
Author: kli Date: Wed Nov 21 11:38:53 2018 New Revision: 347408 URL: http://llvm.org/viewvc/llvm-project?rev=347408&view=rev Log: [OPENMP] remove redundant MapTypeModifierSpecified flag in ParseOpenMP.cpp (NFC) Whether the map type modifier is specified or not, the flag MapTypeModifierSpecified is always set to true. Patch by Ahsan Saghir Differential Revision: https://reviews.llvm.org/D54638 Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=347408&r1=347407&r2=347408&view=diff == --- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original) +++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Wed Nov 21 11:38:53 2018 @@ -1775,7 +1775,6 @@ bool Parser::ParseOpenMPVarList(OpenMPDi OpenMPVarListDataTy &Data) { UnqualifiedId UnqualifiedReductionId; bool InvalidReductionId = false; - bool MapTypeModifierSpecified = false; // Parse '('. BalancedDelimiterTracker T(*this, tok::l_paren, tok::annot_pragma_openmp_end); @@ -1878,8 +1877,6 @@ bool Parser::ParseOpenMPVarList(OpenMPDi if (Data.MapTypeModifier != OMPC_MAP_always) { Diag(Tok, diag::err_omp_unknown_map_type_modifier); Data.MapTypeModifier = OMPC_MAP_unknown; - } else { -MapTypeModifierSpecified = true; } ConsumeToken(); @@ -1904,8 +1901,6 @@ bool Parser::ParseOpenMPVarList(OpenMPDi if (Data.MapTypeModifier != OMPC_MAP_always) { Diag(Tok, diag::err_omp_unknown_map_type_modifier); Data.MapTypeModifier = OMPC_MAP_unknown; - } else { -MapTypeModifierSpecified = true; } ConsumeToken(); @@ -1942,9 +1937,7 @@ bool Parser::ParseOpenMPVarList(OpenMPDi (Kind != OMPC_reduction && Kind != OMPC_task_reduction && Kind != OMPC_in_reduction && Kind != OMPC_depend && Kind != OMPC_map) || (Kind == OMPC_reduction && !InvalidReductionId) || - (Kind == OMPC_map && Data.MapType != OMPC_MAP_unknown && - (!MapTypeModifierSpecified || -Data.MapTypeModifier == OMPC_MAP_always)) || + (Kind == OMPC_map && Data.MapType != OMPC_MAP_unknown) || (Kind == OMPC_depend && Data.DepKind != OMPC_DEPEND_unknown); const bool MayHaveTail = (Kind == OMPC_linear || Kind == OMPC_aligned); while (IsComma || (Tok.isNot(tok::r_paren) && Tok.isNot(tok::colon) && ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r347411 - [OPENMP] Refactor code for parsing omp declare target directive and its clauses (NFC)
Author: kli Date: Wed Nov 21 12:15:57 2018 New Revision: 347411 URL: http://llvm.org/viewvc/llvm-project?rev=347411&view=rev Log: [OPENMP] Refactor code for parsing omp declare target directive and its clauses (NFC) This patch refactor the code for parsing omp declare target directive and its clauses. Patch by pjeeva01 (Jeeva P.) Differential Revision: https://reviews.llvm.org/D54708 Modified: cfe/trunk/include/clang/Parse/Parser.h cfe/trunk/lib/Parse/ParseOpenMP.cpp Modified: cfe/trunk/include/clang/Parse/Parser.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=347411&r1=347410&r2=347411&view=diff == --- cfe/trunk/include/clang/Parse/Parser.h (original) +++ cfe/trunk/include/clang/Parse/Parser.h Wed Nov 21 12:15:57 2018 @@ -2775,6 +2775,11 @@ private: DeclGroupPtrTy ParseOMPDeclareSimdClauses(DeclGroupPtrTy Ptr, CachedTokens &Toks, SourceLocation Loc); + /// Parse clauses for '#pragma omp declare target'. + DeclGroupPtrTy ParseOMPDeclareTargetClauses(); + /// Parse '#pragma omp end declare target'. + void ParseOMPEndDeclareTargetDirective(OpenMPDirectiveKind DKind, + SourceLocation Loc); /// Parses declarative OpenMP directives. DeclGroupPtrTy ParseOpenMPDeclarativeDirectiveWithExtDecl( AccessSpecifier &AS, ParsedAttributesWithRange &Attrs, Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=347411&r1=347410&r2=347411&view=diff == --- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original) +++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Wed Nov 21 12:15:57 2018 @@ -644,6 +644,60 @@ Parser::ParseOMPDeclareSimdClauses(Parse LinModifiers, Steps, SourceRange(Loc, EndLoc)); } +Parser::DeclGroupPtrTy Parser::ParseOMPDeclareTargetClauses() { + // OpenMP 4.5 syntax with list of entities. + Sema::NamedDeclSetType SameDirectiveDecls; + while (Tok.isNot(tok::annot_pragma_openmp_end)) { +OMPDeclareTargetDeclAttr::MapTypeTy MT = OMPDeclareTargetDeclAttr::MT_To; +if (Tok.is(tok::identifier)) { + IdentifierInfo *II = Tok.getIdentifierInfo(); + StringRef ClauseName = II->getName(); + // Parse 'to|link' clauses. + if (!OMPDeclareTargetDeclAttr::ConvertStrToMapTypeTy(ClauseName, MT)) { +Diag(Tok, diag::err_omp_declare_target_unexpected_clause) << ClauseName; +break; + } + ConsumeToken(); +} +auto &&Callback = [this, MT, &SameDirectiveDecls]( +CXXScopeSpec &SS, DeclarationNameInfo NameInfo) { + Actions.ActOnOpenMPDeclareTargetName(getCurScope(), SS, NameInfo, MT, + SameDirectiveDecls); +}; +if (ParseOpenMPSimpleVarList(OMPD_declare_target, Callback, + /*AllowScopeSpecifier=*/true)) + break; + +// Consume optional ','. +if (Tok.is(tok::comma)) + ConsumeToken(); + } + SkipUntil(tok::annot_pragma_openmp_end, StopBeforeMatch); + ConsumeAnyToken(); + SmallVector Decls(SameDirectiveDecls.begin(), + SameDirectiveDecls.end()); + if (Decls.empty()) +return DeclGroupPtrTy(); + return Actions.BuildDeclaratorGroup(Decls); +} + +void Parser::ParseOMPEndDeclareTargetDirective(OpenMPDirectiveKind DKind, + SourceLocation DTLoc) { + if (DKind != OMPD_end_declare_target) { +Diag(Tok, diag::err_expected_end_declare_target); +Diag(DTLoc, diag::note_matching) << "'#pragma omp declare target'"; +return; + } + ConsumeAnyToken(); + if (Tok.isNot(tok::annot_pragma_openmp_end)) { +Diag(Tok, diag::warn_omp_extra_tokens_at_eol) +<< getOpenMPDirectiveName(OMPD_end_declare_target); +SkipUntil(tok::annot_pragma_openmp_end, StopBeforeMatch); + } + // Skip the last annot_pragma_openmp_end. + ConsumeAnyToken(); +} + /// Parsing of declarative OpenMP directives. /// /// threadprivate-directive: @@ -785,43 +839,7 @@ Parser::DeclGroupPtrTy Parser::ParseOpen case OMPD_declare_target: { SourceLocation DTLoc = ConsumeAnyToken(); if (Tok.isNot(tok::annot_pragma_openmp_end)) { - // OpenMP 4.5 syntax with list of entities. - Sema::NamedDeclSetType SameDirectiveDecls; - while (Tok.isNot(tok::annot_pragma_openmp_end)) { -OMPDeclareTargetDeclAttr::MapTypeTy MT = -OMPDeclareTargetDeclAttr::MT_To; -if (Tok.is(tok::identifier)) { - IdentifierInfo *II = Tok.getIdentifierInfo(); - StringRef ClauseName = II->getName(); - // Parse 'to|link' clauses. - if (!OMPDeclareTargetDeclAttr::ConvertStrToMapTypeTy(ClauseName, -
r347723 - [OPENMP] remove redundant ColonExpected flag in ParseOpenMP.cpp (NFC)
Author: kli Date: Tue Nov 27 16:51:08 2018 New Revision: 347723 URL: http://llvm.org/viewvc/llvm-project?rev=347723&view=rev Log: [OPENMP] remove redundant ColonExpected flag in ParseOpenMP.cpp (NFC) The flag ColonExpected is not changed after being initialized to false at declaration. Patch by Ahsan Saghir Differential Revision: https://reviews.llvm.org/D54958 Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp Modified: cfe/trunk/lib/Parse/ParseOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseOpenMP.cpp?rev=347723&r1=347722&r2=347723&view=diff == --- cfe/trunk/lib/Parse/ParseOpenMP.cpp (original) +++ cfe/trunk/lib/Parse/ParseOpenMP.cpp Tue Nov 27 16:51:08 2018 @@ -1867,7 +1867,6 @@ bool Parser::ParseOpenMPVarList(OpenMPDi getOpenMPSimpleClauseType(Kind, PP.getSpelling(Tok))) : OMPC_MAP_unknown; Data.DepLinMapLoc = Tok.getLocation(); -bool ColonExpected = false; if (IsMapClauseModifierToken(Tok)) { if (PP.LookAhead(0).is(tok::colon)) { @@ -1935,8 +1934,6 @@ bool Parser::ParseOpenMPVarList(OpenMPDi if (Tok.is(tok::colon)) Data.ColonLoc = ConsumeToken(); -else if (ColonExpected) - Diag(Tok, diag::warn_pragma_expected_colon) << "map type"; } bool IsComma = ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r342322 - [OPENMP] Move OMPClauseReader/Writer classes to ASTReader/Writer (NFC)
Author: kli Date: Sat Sep 15 06:54:15 2018 New Revision: 342322 URL: http://llvm.org/viewvc/llvm-project?rev=342322&view=rev Log: [OPENMP] Move OMPClauseReader/Writer classes to ASTReader/Writer (NFC) Move declarations for OMPClauseReader, OMPClauseWriter to ASTReader.h and ASTWriter.h and move implementation to ASTReader.cpp and ASTWriter.cpp. This change helps generalize the serialization of OpenMP clauses and will be used in the future implementation of new OpenMP directives (e.g. requires). Patch by Patrick Lyster Differential Revision: https://reviews.llvm.org/D52097 Modified: cfe/trunk/include/clang/AST/OpenMPClause.h cfe/trunk/include/clang/AST/StmtVisitor.h cfe/trunk/include/clang/Serialization/ASTReader.h cfe/trunk/include/clang/Serialization/ASTWriter.h cfe/trunk/lib/Serialization/ASTReader.cpp cfe/trunk/lib/Serialization/ASTReaderStmt.cpp cfe/trunk/lib/Serialization/ASTWriter.cpp cfe/trunk/lib/Serialization/ASTWriterStmt.cpp Modified: cfe/trunk/include/clang/AST/OpenMPClause.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=342322&r1=342321&r2=342322&view=diff == --- cfe/trunk/include/clang/AST/OpenMPClause.h (original) +++ cfe/trunk/include/clang/AST/OpenMPClause.h Sat Sep 15 06:54:15 2018 @@ -5041,6 +5041,43 @@ public: } }; +/// This class implements a simple visitor for OMPClause +/// subclasses. +template class Ptr, typename RetTy> +class OMPClauseVisitorBase { +public: +#define PTR(CLASS) typename Ptr::type +#define DISPATCH(CLASS) \ + return static_cast(this)->Visit##CLASS(static_cast(S)) + +#define OPENMP_CLAUSE(Name, Class) \ + RetTy Visit ## Class (PTR(Class) S) { DISPATCH(Class); } +#include "clang/Basic/OpenMPKinds.def" + + RetTy Visit(PTR(OMPClause) S) { +// Top switch clause: visit each OMPClause. +switch (S->getClauseKind()) { +default: llvm_unreachable("Unknown clause kind!"); +#define OPENMP_CLAUSE(Name, Class) \ +case OMPC_ ## Name : return Visit ## Class(static_cast(S)); +#include "clang/Basic/OpenMPKinds.def" +} + } + // Base case, ignore it. :) + RetTy VisitOMPClause(PTR(OMPClause) Node) { return RetTy(); } +#undef PTR +#undef DISPATCH +}; + +template +using const_ptr = typename std::add_pointer::type>; + +template +class OMPClauseVisitor : + public OMPClauseVisitorBase {}; +template +class ConstOMPClauseVisitor : + public OMPClauseVisitorBase {}; } // namespace clang #endif // LLVM_CLANG_AST_OPENMPCLAUSE_H Modified: cfe/trunk/include/clang/AST/StmtVisitor.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtVisitor.h?rev=342322&r1=342321&r2=342322&view=diff == --- cfe/trunk/include/clang/AST/StmtVisitor.h (original) +++ cfe/trunk/include/clang/AST/StmtVisitor.h Sat Sep 15 06:54:15 2018 @@ -195,41 +195,6 @@ template {}; -/// This class implements a simple visitor for OMPClause -/// subclasses. -template class Ptr, typename RetTy> -class OMPClauseVisitorBase { -public: -#define PTR(CLASS) typename Ptr::type -#define DISPATCH(CLASS) \ - return static_cast(this)->Visit##CLASS(static_cast(S)) - -#define OPENMP_CLAUSE(Name, Class) \ - RetTy Visit ## Class (PTR(Class) S) { DISPATCH(Class); } -#include "clang/Basic/OpenMPKinds.def" - - RetTy Visit(PTR(OMPClause) S) { -// Top switch clause: visit each OMPClause. -switch (S->getClauseKind()) { -default: llvm_unreachable("Unknown clause kind!"); -#define OPENMP_CLAUSE(Name, Class) \ -case OMPC_ ## Name : return Visit ## Class(static_cast(S)); -#include "clang/Basic/OpenMPKinds.def" -} - } - // Base case, ignore it. :) - RetTy VisitOMPClause(PTR(OMPClause) Node) { return RetTy(); } -#undef PTR -#undef DISPATCH -}; - -template -class OMPClauseVisitor : - public OMPClauseVisitorBase {}; -template -class ConstOMPClauseVisitor : - public OMPClauseVisitorBase {}; - } // namespace clang #endif // LLVM_CLANG_AST_STMTVISITOR_H Modified: cfe/trunk/include/clang/Serialization/ASTReader.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=342322&r1=342321&r2=342322&view=diff == --- cfe/trunk/include/clang/Serialization/ASTReader.h (original) +++ cfe/trunk/include/clang/Serialization/ASTReader.h Sat Sep 15 06:54:15 2018 @@ -18,6 +18,7 @@ #include "clang/AST/DeclObjC.h" #include "clang/AST/DeclarationName.h" #include "clang/AST/NestedNameSpecifier.h" +#include "clang/AST/OpenMPClause.h" #include "clang/AST/TemplateBase.h" #include "clang/AST/TemplateName.h" #include "clang/AST/Type.h" @@ -2677,6 +2678,21 @@ inline void PCHValidator::Error(const ch Reader.Error(
r343063 - [OPENMP] Add support for OMP5 requires directive + unified_address clause
Author: kli Date: Tue Sep 25 21:28:39 2018 New Revision: 343063 URL: http://llvm.org/viewvc/llvm-project?rev=343063&view=rev Log: [OPENMP] Add support for OMP5 requires directive + unified_address clause Add support for OMP5.0 requires directive and unified_address clause. Patches to follow will include support for additional clauses. Differential Revision: https://reviews.llvm.org/D52359 Added: cfe/trunk/test/OpenMP/requires_unified_address_ast_print.cpp cfe/trunk/test/OpenMP/requires_unified_address_messages.cpp Modified: cfe/trunk/include/clang/AST/DeclOpenMP.h cfe/trunk/include/clang/AST/OpenMPClause.h cfe/trunk/include/clang/AST/RecursiveASTVisitor.h cfe/trunk/include/clang/Basic/DeclNodes.td cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/include/clang/Basic/OpenMPKinds.def cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/include/clang/Serialization/ASTBitCodes.h cfe/trunk/lib/AST/ASTDumper.cpp cfe/trunk/lib/AST/DeclBase.cpp cfe/trunk/lib/AST/DeclOpenMP.cpp cfe/trunk/lib/AST/DeclPrinter.cpp cfe/trunk/lib/AST/OpenMPClause.cpp cfe/trunk/lib/AST/StmtPrinter.cpp cfe/trunk/lib/AST/StmtProfile.cpp cfe/trunk/lib/Basic/OpenMPKinds.cpp cfe/trunk/lib/CodeGen/CGDecl.cpp cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp cfe/trunk/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp cfe/trunk/lib/CodeGen/CodeGenModule.cpp cfe/trunk/lib/CodeGen/CodeGenModule.h cfe/trunk/lib/Parse/ParseOpenMP.cpp cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp cfe/trunk/lib/Sema/TreeTransform.h cfe/trunk/lib/Serialization/ASTCommon.cpp cfe/trunk/lib/Serialization/ASTReader.cpp cfe/trunk/lib/Serialization/ASTReaderDecl.cpp cfe/trunk/lib/Serialization/ASTWriter.cpp cfe/trunk/lib/Serialization/ASTWriterDecl.cpp cfe/trunk/tools/libclang/CIndex.cpp Modified: cfe/trunk/include/clang/AST/DeclOpenMP.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclOpenMP.h?rev=343063&r1=343062&r2=343063&view=diff == --- cfe/trunk/include/clang/AST/DeclOpenMP.h (original) +++ cfe/trunk/include/clang/AST/DeclOpenMP.h Tue Sep 25 21:28:39 2018 @@ -18,6 +18,7 @@ #include "clang/AST/Decl.h" #include "clang/AST/Expr.h" #include "clang/AST/ExternalASTSource.h" +#include "clang/AST/OpenMPClause.h" #include "clang/AST/Type.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/Support/TrailingObjects.h" @@ -239,6 +240,76 @@ public: static bool classofKind(Kind K) { return K == OMPCapturedExpr; } }; +/// This represents '#pragma omp requires...' directive. +/// For example +/// +/// \code +/// #pragma omp requires unified_address +/// \endcode +/// +class OMPRequiresDecl final +: public Decl, + private llvm::TrailingObjects { + friend class ASTDeclReader; + friend TrailingObjects; + + // Number of clauses associated with this requires declaration + unsigned NumClauses = 0; + + virtual void anchor(); + + OMPRequiresDecl(Kind DK, DeclContext *DC, SourceLocation L) + : Decl(DK, DC, L), NumClauses(0) {} + + /// Returns an array of immutable clauses associated with this requires + /// declaration + ArrayRef getClauses() const { +return llvm::makeArrayRef(getTrailingObjects(), NumClauses); + } + + /// Returns an array of clauses associated with this requires declaration + MutableArrayRef getClauses() { +return MutableArrayRef(getTrailingObjects(), +NumClauses); + } + + /// Sets an array of clauses to this requires declaration + void setClauses(ArrayRef CL); + +public: + /// Create requires node. + static OMPRequiresDecl *Create(ASTContext &C, DeclContext *DC, + SourceLocation L, ArrayRef CL); + /// Create deserialized requires node. + static OMPRequiresDecl *CreateDeserialized(ASTContext &C, unsigned ID, + unsigned N); + + using clauselist_iterator = MutableArrayRef::iterator; + using clauselist_const_iterator = ArrayRef::iterator; + using clauselist_range = llvm::iterator_range; + using clauselist_const_range = llvm::iterator_range; + + unsigned clauselist_size() const { return NumClauses; } + bool clauselist_empty() const { return NumClauses == 0; } + + clauselist_range clauselists() { +return clauselist_range(clauselist_begin(), clauselist_end()); + } + clauselist_const_range clauselists() const { +return clauselist_const_range(clauselist_begin(), clauselist_end()); + } + clauselist_iterator clauselist_begin() { return getClauses().begin(); } + clauselist_iterator clauselist_end() { return getClauses().end(); } + clauselist_const_iterator clauselist_begin() const { +return getClauses().begin(); + } + clauselist_const_iterat
r353186 - [OPENMP] issue error messages for multiple teams contructs in a target construct
Author: kli Date: Tue Feb 5 08:43:00 2019 New Revision: 353186 URL: http://llvm.org/viewvc/llvm-project?rev=353186&view=rev Log: [OPENMP] issue error messages for multiple teams contructs in a target construct The fix is to issue error messages if there are more than one teams construct inside a target constructs. #pragma omp target { #pragma omp teams { ... } #pragma omp teams { ... } } Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/test/OpenMP/nesting_of_regions.cpp Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=353186&r1=353185&r2=353186&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Tue Feb 5 08:43:00 2019 @@ -7067,7 +7067,9 @@ StmtResult Sema::ActOnOpenMPTargetDirect auto I = CS->body_begin(); while (I != CS->body_end()) { const auto *OED = dyn_cast(*I); -if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind())) { +if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind()) || +OMPTeamsFound) { + OMPTeamsFound = false; break; } Modified: cfe/trunk/test/OpenMP/nesting_of_regions.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/nesting_of_regions.cpp?rev=353186&r1=353185&r2=353186&view=diff == --- cfe/trunk/test/OpenMP/nesting_of_regions.cpp (original) +++ cfe/trunk/test/OpenMP/nesting_of_regions.cpp Tue Feb 5 08:43:00 2019 @@ -4080,6 +4080,13 @@ void foo() { } #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} { +#pragma omp teams // expected-note {{directive outside teams construct here}} +++a; +#pragma omp teams // expected-note {{nested teams construct here}} +++a; + } +#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} + { ++a; // expected-note {{statement outside teams construct here}} #pragma omp teams // expected-note {{nested teams construct here}} ++a; @@ -12692,6 +12699,13 @@ void foo() { ++a; } #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} + { +#pragma omp teams // expected-note {{directive outside teams construct here}} +++a; +#pragma omp teams // expected-note {{nested teams construct here}} +++a; + } +#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} { ++a; // expected-note {{statement outside teams construct here}} #pragma omp teams // expected-note {{nested teams construct here}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r349551 - [OPENMP] parsing and sema support for 'close' map-type-modifier
Author: kli Date: Tue Dec 18 14:18:41 2018 New Revision: 349551 URL: http://llvm.org/viewvc/llvm-project?rev=349551&view=rev Log: [OPENMP] parsing and sema support for 'close' map-type-modifier A map clause with the close map-type-modifier is a hint to prefer that the variables are mapped using a copy into faster memory. Patch by Ahsan Saghir (saghir) Differential Revision: https://reviews.llvm.org/D55719 Modified: cfe/trunk/include/clang/AST/OpenMPClause.h cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/include/clang/Basic/OpenMPKinds.def cfe/trunk/include/clang/Basic/OpenMPKinds.h cfe/trunk/include/clang/Parse/Parser.h cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/AST/OpenMPClause.cpp cfe/trunk/lib/Basic/OpenMPKinds.cpp cfe/trunk/lib/CodeGen/CGOpenMPRuntime.cpp cfe/trunk/lib/Parse/ParseOpenMP.cpp cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/lib/Sema/TreeTransform.h cfe/trunk/lib/Serialization/ASTReader.cpp cfe/trunk/lib/Serialization/ASTWriter.cpp cfe/trunk/test/OpenMP/target_ast_print.cpp cfe/trunk/test/OpenMP/target_data_ast_print.cpp cfe/trunk/test/OpenMP/target_map_messages.cpp cfe/trunk/test/OpenMP/target_parallel_for_map_messages.cpp cfe/trunk/test/OpenMP/target_parallel_for_simd_map_messages.cpp cfe/trunk/test/OpenMP/target_parallel_map_messages.cpp cfe/trunk/test/OpenMP/target_simd_map_messages.cpp cfe/trunk/test/OpenMP/target_teams_distribute_map_messages.cpp cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_map_messages.cpp cfe/trunk/test/OpenMP/target_teams_distribute_parallel_for_simd_map_messages.cpp cfe/trunk/test/OpenMP/target_teams_distribute_simd_map_messages.cpp cfe/trunk/test/OpenMP/target_teams_map_messages.cpp Modified: cfe/trunk/include/clang/AST/OpenMPClause.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=349551&r1=349550&r2=349551&view=diff == --- cfe/trunk/include/clang/AST/OpenMPClause.h (original) +++ cfe/trunk/include/clang/AST/OpenMPClause.h Tue Dec 18 14:18:41 2018 @@ -4061,8 +4061,19 @@ class OMPMapClause final : public OMPMap return getUniqueDeclarationsNum() + getTotalComponentListNum(); } - /// Map type modifier for the 'map' clause. - OpenMPMapClauseKind MapTypeModifier = OMPC_MAP_unknown; +public: + /// Number of allowed map-type-modifiers. + static constexpr unsigned NumberOfModifiers = + OMPC_MAP_MODIFIER_last - OMPC_MAP_MODIFIER_unknown - 1; + +private: + /// Map-type-modifiers for the 'map' clause. + OpenMPMapModifierKind MapTypeModifiers[NumberOfModifiers] = { +OMPC_MAP_MODIFIER_unknown, OMPC_MAP_MODIFIER_unknown + }; + + /// Location of map-type-modifiers for the 'map' clause. + SourceLocation MapTypeModifiersLoc[NumberOfModifiers]; /// Map type for the 'map' clause. OpenMPMapClauseKind MapType = OMPC_MAP_unknown; @@ -4080,7 +4091,8 @@ class OMPMapClause final : public OMPMap /// NumUniqueDeclarations declarations, \a NumComponentLists total component /// lists, and \a NumComponents total expression components. /// - /// \param MapTypeModifier Map type modifier. + /// \param MapModifiers Map-type-modifiers. + /// \param MapModifiersLoc Locations of map-type-modifiers. /// \param MapType Map type. /// \param MapTypeIsImplicit Map type is inferred implicitly. /// \param MapLoc Location of the map type. @@ -4091,7 +4103,8 @@ class OMPMapClause final : public OMPMap /// clause. /// \param NumComponentLists Number of component lists in this clause. /// \param NumComponents Total number of expression components in the clause. - explicit OMPMapClause(OpenMPMapClauseKind MapTypeModifier, + explicit OMPMapClause(ArrayRef MapModifiers, +ArrayRef MapModifiersLoc, OpenMPMapClauseKind MapType, bool MapTypeIsImplicit, SourceLocation MapLoc, SourceLocation StartLoc, SourceLocation LParenLoc, SourceLocation EndLoc, @@ -4100,8 +4113,17 @@ class OMPMapClause final : public OMPMap : OMPMappableExprListClause(OMPC_map, StartLoc, LParenLoc, EndLoc, NumVars, NumUniqueDeclarations, NumComponentLists, NumComponents), -MapTypeModifier(MapTypeModifier), MapType(MapType), -MapTypeIsImplicit(MapTypeIsImplicit), MapLoc(MapLoc) {} +MapType(MapType), MapTypeIsImplicit(MapTypeIsImplicit), +MapLoc(MapLoc) { + assert(llvm::array_lengthof(MapTypeModifiers) == MapModifiers.size() + && "Unexpected number of map type modifiers."); + llvm::copy(MapModifiers, std::begin(MapTypeModifiers)); + + assert(llvm::array_lengthof(MapTypeModifiersLoc) == + MapModifie
[PATCH] D24615: [OpenMP] clang doesnt diagnose if there is a lexical block around a for stmt for OpenMP loops. It is technically not allowed in the OpenMP standard
kkwli0 added a comment. Should we issue a warning message in this case? https://reviews.llvm.org/D24615 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r319458 - [OpenMP] Diagnose undeclared variables on declare target clause
Author: kli Date: Thu Nov 30 10:52:06 2017 New Revision: 319458 URL: http://llvm.org/viewvc/llvm-project?rev=319458&view=rev Log: [OpenMP] Diagnose undeclared variables on declare target clause Clang asserts on undeclared variables on the to or link clause in the declare target directive. The patch is to properly diagnose the error. // foo1 and foo2 are not declared #pragma omp declare target to(foo1) #pragma omp declare target link(foo2) Differential Revision: https://reviews.llvm.org/D40588 Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/test/OpenMP/declare_target_messages.cpp Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=319458&r1=319457&r2=319458&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Thu Nov 30 10:52:06 2017 @@ -1506,7 +1506,7 @@ public: explicit VarOrFuncDeclFilterCCC(Sema &S) : SemaRef(S) {} bool ValidateCandidate(const TypoCorrection &Candidate) override { NamedDecl *ND = Candidate.getCorrectionDecl(); -if (isa(ND) || isa(ND)) { +if (ND && (isa(ND) || isa(ND))) { return SemaRef.isDeclInScope(ND, SemaRef.getCurLexicalContext(), SemaRef.getCurScope()); } Modified: cfe/trunk/test/OpenMP/declare_target_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/declare_target_messages.cpp?rev=319458&r1=319457&r2=319458&view=diff == --- cfe/trunk/test/OpenMP/declare_target_messages.cpp (original) +++ cfe/trunk/test/OpenMP/declare_target_messages.cpp Thu Nov 30 10:52:06 2017 @@ -13,6 +13,10 @@ void f(); #pragma omp declare target map(a) // expected-error {{unexpected 'map' clause, only 'to' or 'link' clauses expected}} +#pragma omp declare target to(foo1) // expected-error {{use of undeclared identifier 'foo1'}} + +#pragma omp declare target link(foo2) // expected-error {{use of undeclared identifier 'foo2'}} + void c(); // expected-warning {{declaration is not declared in any declare target region}} extern int b; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r320506 - Add --cuda-path to mock a CUDA Toolkit installation to avoid
Author: kli Date: Tue Dec 12 10:33:39 2017 New Revision: 320506 URL: http://llvm.org/viewvc/llvm-project?rev=320506&view=rev Log: Add --cuda-path to mock a CUDA Toolkit installation to avoid unexpected error messages for incompatibility between the default SM level and the support in the installed toolkit. Differential Revision: https://reviews.llvm.org/D40996 Modified: cfe/trunk/test/Driver/unknown-std.cpp Modified: cfe/trunk/test/Driver/unknown-std.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/unknown-std.cpp?rev=320506&r1=320505&r2=320506&view=diff == --- cfe/trunk/test/Driver/unknown-std.cpp (original) +++ cfe/trunk/test/Driver/unknown-std.cpp Tue Dec 12 10:33:39 2017 @@ -4,7 +4,7 @@ // RUN: not %clang %s -std=foobar -c 2>&1 | FileCheck --match-full-lines %s // RUN: not %clang -x objective-c++ %s -std=foobar -c 2>&1 | FileCheck --match-full-lines %s -// RUN: not %clang -x cuda -nocudainc -nocudalib %s -std=foobar -c 2>&1 | FileCheck --match-full-lines --check-prefix=CHECK --check-prefix=CUDA %s +// RUN: not %clang -x cuda -nocudainc -nocudalib --cuda-path=%S/Inputs/CUDA/usr/local/cuda %s -std=foobar -c 2>&1 | FileCheck --match-full-lines --check-prefix=CHECK --check-prefix=CUDA %s // CHECK: error: invalid value 'foobar' in '-std=foobar' // CHECK-NEXT: note: use 'c++98' or 'c++03' for 'ISO C++ 1998 with amendments' standard ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r320521 - [OpenMP] Diagnose function name on the link clause
Author: kli Date: Tue Dec 12 12:08:12 2017 New Revision: 320521 URL: http://llvm.org/viewvc/llvm-project?rev=320521&view=rev Log: [OpenMP] Diagnose function name on the link clause This patch is to add diagnose when a function name is specified on the link clause. According to the OpenMP spec, only the list items that exclude the function name are allowed on the link clause. Differential Revision: https://reviews.llvm.org/D40968 Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/test/OpenMP/declare_target_ast_print.cpp cfe/trunk/test/OpenMP/declare_target_messages.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=320521&r1=320520&r2=320521&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Dec 12 12:08:12 2017 @@ -8710,6 +8710,8 @@ def err_omp_declare_target_to_and_link : def warn_omp_not_in_target_context : Warning< "declaration is not declared in any declare target region">, InGroup; +def err_omp_function_in_link_clause : Error< + "function name is not allowed in 'link' clause">; def err_omp_aligned_expected_array_or_ptr : Error< "argument of aligned clause should be array" "%select{ or pointer|, pointer, reference to array or reference to pointer}1" Modified: cfe/trunk/include/clang/Sema/Sema.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=320521&r1=320520&r2=320521&view=diff == --- cfe/trunk/include/clang/Sema/Sema.h (original) +++ cfe/trunk/include/clang/Sema/Sema.h Tue Dec 12 12:08:12 2017 @@ -8656,7 +8656,8 @@ public: OMPDeclareTargetDeclAttr::MapTypeTy MT, NamedDeclSetType &SameDirectiveDecls); /// Check declaration inside target region. - void checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D); + void checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D, +SourceLocation IdLoc = SourceLocation()); /// Return true inside OpenMP declare target region. bool isInOpenMPDeclareTargetContext() const { return IsInOpenMPDeclareTargetContext; Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=320521&r1=320520&r2=320521&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Tue Dec 12 12:08:12 2017 @@ -12600,7 +12600,7 @@ void Sema::ActOnOpenMPDeclareTargetName( ND->addAttr(A); if (ASTMutationListener *ML = Context.getASTMutationListener()) ML->DeclarationMarkedOpenMPDeclareTarget(ND, A); - checkDeclIsAllowedInOpenMPTarget(nullptr, ND); + checkDeclIsAllowedInOpenMPTarget(nullptr, ND, Id.getLoc()); } else if (ND->getAttr()->getMapType() != MT) { Diag(Id.getLoc(), diag::err_omp_declare_target_to_and_link) << Id.getName(); @@ -12689,7 +12689,8 @@ static bool checkValueDeclInTarget(Sourc return true; } -void Sema::checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D) { +void Sema::checkDeclIsAllowedInOpenMPTarget(Expr *E, Decl *D, +SourceLocation IdLoc) { if (!D || D->isInvalidDecl()) return; SourceRange SR = E ? E->getSourceRange() : D->getSourceRange(); @@ -12718,6 +12719,16 @@ void Sema::checkDeclIsAllowedInOpenMPTar return; } } + if (FunctionDecl *FD = dyn_cast(D)) { +if (FD->hasAttr() && +(FD->getAttr()->getMapType() == + OMPDeclareTargetDeclAttr::MT_Link)) { + assert(IdLoc.isValid() && "Source location is expected"); + Diag(IdLoc, diag::err_omp_function_in_link_clause); + Diag(FD->getLocation(), diag::note_defined_here) << FD; + return; +} + } if (!E) { // Checking declaration inside declare target region. if (!D->hasAttr() && Modified: cfe/trunk/test/OpenMP/declare_target_ast_print.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/declare_target_ast_print.cpp?rev=320521&r1=320520&r2=320521&view=diff == --- cfe/trunk/test/OpenMP/declare_target_ast_print.cpp (original) +++ cfe/trunk/test/OpenMP/declare_target_ast_print.cpp Tue Dec 12 12:08:12 2017 @@ -108,9 +108,7 @@ void f2() { // CHECK: #pragma omp end declare target int c1, c2, c3; -void f3() { -} -#pragma omp declare target link(c1) link(c2), link(c3, f3) +#pragma omp declare target link(c1) link(c2), link(c3) // CHECK: #pragma omp de
[llvm] [clang-tools-extra] [flang] [Flang] make ppc unsupported for x86_64 test case (NFC) (PR #73903)
@@ -7,7 +7,7 @@ ! ! This test is for x86_64, where exponent-letter 'q' is for ! 10-byte extended precision -! UNSUPPORTED: system-windows +! UNSUPPORTED: system-windows, system-aix kkwli wrote: Why not `target=powerpc{{.*}}` as PPC is non-x86_64 regardless of the OS? https://github.com/llvm/llvm-project/pull/73903 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [flang] [llvm] [Flang] make ppc unsupported for x86_64 test case (NFC) (PR #73903)
@@ -7,7 +7,7 @@ ! ! This test is for x86_64, where exponent-letter 'q' is for ! 10-byte extended precision -! UNSUPPORTED: system-windows +! UNSUPPORTED: system-windows, system-aix kkwli wrote: Ok https://github.com/llvm/llvm-project/pull/73903 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang-tools-extra] [flang] [llvm] [Flang] make ppc unsupported for x86_64 test case (NFC) (PR #73903)
https://github.com/kkwli approved this pull request. LG. Thanks https://github.com/llvm/llvm-project/pull/73903 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 8ea4aed - [OpenMP] Add search path for llvm-strip
Author: Kelvin Li Date: 2022-02-04T22:15:14-05:00 New Revision: 8ea4aed50a9f84d9617219ccc936c005c5f31c24 URL: https://github.com/llvm/llvm-project/commit/8ea4aed50a9f84d9617219ccc936c005c5f31c24 DIFF: https://github.com/llvm/llvm-project/commit/8ea4aed50a9f84d9617219ccc936c005c5f31c24.diff LOG: [OpenMP] Add search path for llvm-strip Add the build directory to the search path for llvm-strip instead of solely relying on the PATH environment variable setting. Reviewed By: jhuber6 Differential Revision: https://reviews.llvm.org/D118965 Added: Modified: clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp Removed: diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp index de0af187731d3..2f5ddb77b7b3f 100644 --- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp +++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp @@ -310,7 +310,13 @@ extractFromBinary(const ObjectFile &Obj, // We will use llvm-strip to remove the now unneeded section containing the // offloading code. - ErrorOr StripPath = sys::findProgramByName("llvm-strip"); + void *P = (void *)(intptr_t)&Help; + StringRef COWDir = ""; + auto COWPath = sys::fs::getMainExecutable("llvm-strip", P); + if (!COWPath.empty()) +COWDir = sys::path::parent_path(COWPath); + ErrorOr StripPath = + sys::findProgramByName("llvm-strip", {COWDir}); if (!StripPath) return createStringError(StripPath.getError(), "Unable to find 'llvm-strip' in path"); ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang][driver] Add support for -isysroot in the frontend (PR #77365)
kkwli wrote: If the compiler is built with `DEFAULT_SYSROOT`, the `-isysroot` option is ignored. Is that the expected behavior? My local MacOS build (with `-DDEFAULT_SYSROOT="$(xcrun --show-sdk-path)"`) has `isysroot.f90` failed. https://github.com/llvm/llvm-project/pull/77365 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang][driver] Allow explicit specification of -lFortran_main (PR #78152)
kkwli wrote: How would `flang-new -fno-fortran-main t.f -lFortran_main` work? https://github.com/llvm/llvm-project/pull/78152 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[flang] [clang] [flang][driver] Allow explicit specification of -lFortran_main (PR #78152)
kkwli wrote: > > How would `flang-new -fno-fortran-main t.f -lFortran_main` work? > > Good question. This won't work with this patch but currently should work. > I'll have to fix this. > > Do you agree that `flang-new -lFortran_main` is something we want to make > work? In my opinion, we should hide 'libFortran_main' as much as possible since it is really an implementation detail. I can see that the proposed behavior will give users less surprise. I am slightly in favor of this behavior. In a long run, I still think that we need to get rid of `Fortran_main`. Perhaps, for the minimal, we can rename it to remove `Fortran` in the name to make people think that it is not required (by the users) to do any linking for Fortran code. https://github.com/llvm/llvm-project/pull/78152 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang][driver] Add support for -isysroot in the frontend (PR #77365)
kkwli wrote: > My plan is the following: > > * Try to fix isysroot.f90 test by making DEFAULT_SYSROOT a LIT "feature". > > * Keep using -isysroot on Flang's tests, on Darwin, as it seems to be the > recommended way to select an SDK. > > * Add support for -sysroot. > > > Does it look good? @luporl Thanks a lot. Your proposed plan looks good to me. https://github.com/llvm/llvm-project/pull/77365 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang][driver] Allow explicit specification of -lFortran_main (PR #78152)
kkwli wrote: > > How would `flang-new -fno-fortran-main t.f -lFortran_main` work? > > This works because I only remove `-lFortran_main` when it is going to be > added implicitly. `-fno-fortran-main` ensures that we never reach this > branch. I've added a test to verify this. I don't know what is the right way to handle the case that users have conflicting flags specified. This behavior is to only remove the implicit `-lFortran_main` not the explicit one. However, in my opinion, the `-fno-fortran-main` is an explicit intent that the users do not want the `main` whether or not `-lFortran_main` is specified. https://github.com/llvm/llvm-project/pull/78152 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[flang] [clang] [flang][driver] deprecate manual usage of -lFortran_main (PR #79016)
https://github.com/kkwli approved this pull request. LG. Thanks https://github.com/llvm/llvm-project/pull/79016 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 427ffa2 - [OpenMP] diagnose zero-length array section in the depend clause
Author: Kelvin Li Date: 2020-01-03T11:55:37-05:00 New Revision: 427ffa2cdbbc7337d903ba71823a7830fa92568d URL: https://github.com/llvm/llvm-project/commit/427ffa2cdbbc7337d903ba71823a7830fa92568d DIFF: https://github.com/llvm/llvm-project/commit/427ffa2cdbbc7337d903ba71823a7830fa92568d.diff LOG: [OpenMP] diagnose zero-length array section in the depend clause The OpenMP specification disallows having zero-length array sections in the depend clause (OpenMP 5.0 2.17.11). Differential Revision: https://reviews.llvm.org/D71969 Added: Modified: clang/include/clang/Basic/DiagnosticSemaKinds.td clang/lib/Sema/SemaOpenMP.cpp clang/test/OpenMP/target_depend_messages.cpp clang/test/OpenMP/target_enter_data_depend_messages.cpp clang/test/OpenMP/target_exit_data_depend_messages.cpp clang/test/OpenMP/target_parallel_depend_messages.cpp clang/test/OpenMP/target_parallel_for_depend_messages.cpp clang/test/OpenMP/target_parallel_for_simd_depend_messages.cpp clang/test/OpenMP/target_simd_depend_messages.cpp clang/test/OpenMP/target_teams_depend_messages.cpp clang/test/OpenMP/target_teams_distribute_depend_messages.cpp clang/test/OpenMP/target_teams_distribute_parallel_for_depend_messages.cpp clang/test/OpenMP/target_teams_distribute_parallel_for_simd_depend_messages.cpp clang/test/OpenMP/target_teams_distribute_simd_depend_messages.cpp clang/test/OpenMP/target_update_depend_messages.cpp clang/test/OpenMP/task_depend_messages.cpp Removed: diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 54299a0409fd..99ce42dd7533 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -9640,6 +9640,8 @@ def err_omp_depend_sink_expected_plus_minus : Error< "expected '+' or '-' operation">; def err_omp_depend_sink_source_not_allowed : Error< "'depend(%select{source|sink:vec}0)' clause%select{|s}0 cannot be mixed with 'depend(%select{sink:vec|source}0)' clause%select{s|}0">; +def err_omp_depend_zero_length_array_section_not_allowed : Error< + "zero-length array section is not allowed in 'depend' clause">; def err_omp_linear_ordered : Error< "'linear' clause cannot be specified along with 'ordered' clause with a parameter">; def err_omp_unexpected_schedule_modifier : Error< diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 23cd6f04a93d..5a4254f11a8b 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -15020,6 +15020,22 @@ Sema::ActOnOpenMPDependClause(OpenMPDependClauseKind DepKind, } OpsOffs.emplace_back(RHS, OOK); } else { + // OpenMP 5.0 [2.17.11, Restrictions] + // List items used in depend clauses cannot be zero-length array sections. + const auto *OASE = dyn_cast(SimpleExpr); + if (OASE) { +const Expr *Length = OASE->getLength(); +Expr::EvalResult Result; +if (Length && !Length->isValueDependent() && +Length->EvaluateAsInt(Result, Context) && +Result.Val.getInt().isNullValue()) { + Diag(ELoc, + diag::err_omp_depend_zero_length_array_section_not_allowed) + << SimpleExpr->getSourceRange(); + continue; +} + } + auto *ASE = dyn_cast(SimpleExpr); if (!RefExpr->IgnoreParenImpCasts()->isLValue() || (ASE && diff --git a/clang/test/OpenMP/target_depend_messages.cpp b/clang/test/OpenMP/target_depend_messages.cpp index a18bc5d5edcb..df8723e12bee 100644 --- a/clang/test/OpenMP/target_depend_messages.cpp +++ b/clang/test/OpenMP/target_depend_messages.cpp @@ -74,7 +74,7 @@ int main(int argc, char **argv, char *env[]) { foo(); #pragma omp target depend (in : argv[0:-1]) // expected-error {{section length is evaluated to a negative value -1}} foo(); - #pragma omp target depend (in : argv[-1:0]) + #pragma omp target depend (in : argv[-1:0]) // expected-error {{zero-length array section is not allowed in 'depend' clause}} foo(); #pragma omp target depend (in : argv[:]) // expected-error {{section length is unspecified and cannot be inferred because subscripted value is not an array}} foo(); diff --git a/clang/test/OpenMP/target_enter_data_depend_messages.cpp b/clang/test/OpenMP/target_enter_data_depend_messages.cpp index 49dddfcc7cba..6d459e8793e6 100644 --- a/clang/test/OpenMP/target_enter_data_depend_messages.cpp +++ b/clang/test/OpenMP/target_enter_data_depend_messages.cpp @@ -70,7 +70,7 @@ int tmain(T argc, S **argv, R *env[]) { foo(); #pragma omp target enter data map(to: i) depend (in : argv[0:-1]) // expected-error {{section length is evaluated to a negative value -1}} foo(); - #pragma omp target enter data map(to: i) depend (in : argv[-1:0]) + #pragma omp target
[clang] 00769d6 - [flang] Add -fppc-native-vector-element-order option to control the element order in PowerPC vector types
Author: Kelvin Li Date: 2023-08-04T17:11:30-04:00 New Revision: 00769d69fbaa39ecdcbbaf826a35ad999bdc951e URL: https://github.com/llvm/llvm-project/commit/00769d69fbaa39ecdcbbaf826a35ad999bdc951e DIFF: https://github.com/llvm/llvm-project/commit/00769d69fbaa39ecdcbbaf826a35ad999bdc951e.diff LOG: [flang] Add -fppc-native-vector-element-order option to control the element order in PowerPC vector types This patch also adds a LIT test for the vec_cvf intrinsic that can be affected by the option. Co-authored-by: Mark Danial Co-authored-by: Daniel Chen Differential Revision: https://reviews.llvm.org/D155852 Added: flang/test/Lower/PowerPC/ppc-vec_cvf-elem-order.f90 Modified: clang/include/clang/Driver/Options.td clang/lib/Driver/ToolChains/Flang.cpp flang/include/flang/Lower/CustomIntrinsicCall.h flang/include/flang/Lower/LoweringOptions.def flang/include/flang/Optimizer/Builder/IntrinsicCall.h flang/include/flang/Optimizer/Builder/PPCIntrinsicCall.h flang/lib/Frontend/CompilerInvocation.cpp flang/lib/Lower/ConvertExpr.cpp flang/lib/Lower/CustomIntrinsicCall.cpp flang/lib/Optimizer/Builder/IntrinsicCall.cpp flang/lib/Optimizer/Builder/PPCIntrinsicCall.cpp flang/test/Driver/driver-help-hidden.f90 flang/test/Driver/driver-help.f90 flang/test/Driver/frontend-forwarding.f90 flang/tools/bbc/bbc.cpp Removed: diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 840cfa3f368504..fb3534133b5213 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5416,6 +5416,9 @@ defm xor_operator : OptInFC1FFlag<"xor-operator", "Enable .XOR. as a synonym of defm logical_abbreviations : OptInFC1FFlag<"logical-abbreviations", "Enable logical abbreviations">; defm implicit_none : OptInFC1FFlag<"implicit-none", "No implicit typing allowed unless overridden by IMPLICIT statements">; defm underscoring : OptInFC1FFlag<"underscoring", "Appends one trailing underscore to external names">; +defm ppc_native_vec_elem_order: BoolOptionWithoutMarshalling<"f", "ppc-native-vector-element-order", + PosFlag, + NegFlag>; def fno_automatic : Flag<["-"], "fno-automatic">, Group, HelpText<"Implies the SAVE attribute for non-automatic local objects in subprograms unless RECURSIVE">; diff --git a/clang/lib/Driver/ToolChains/Flang.cpp b/clang/lib/Driver/ToolChains/Flang.cpp index 0c86f5269cddd7..d0ab58bf4a8559 100644 --- a/clang/lib/Driver/ToolChains/Flang.cpp +++ b/clang/lib/Driver/ToolChains/Flang.cpp @@ -144,7 +144,9 @@ void Flang::addCodegenOptions(const ArgList &Args, CmdArgs.push_back("-fversion-loops-for-stride"); Args.AddAllArgs(CmdArgs, {options::OPT_flang_experimental_hlfir, -options::OPT_flang_experimental_polymorphism}); +options::OPT_flang_experimental_polymorphism, +options::OPT_fno_ppc_native_vec_elem_order, +options::OPT_fppc_native_vec_elem_order}); } void Flang::addPicOptions(const ArgList &Args, ArgStringList &CmdArgs) const { diff --git a/flang/include/flang/Lower/CustomIntrinsicCall.h b/flang/include/flang/Lower/CustomIntrinsicCall.h index 253a53c2346f93..31d0d0e07899a2 100644 --- a/flang/include/flang/Lower/CustomIntrinsicCall.h +++ b/flang/include/flang/Lower/CustomIntrinsicCall.h @@ -103,11 +103,12 @@ lowerCustomIntrinsic(fir::FirOpBuilder &builder, mlir::Location loc, /// Generate the FIR+MLIR operations for the generic intrinsic \p name /// with argument \p args and expected result type \p resultType. /// Returned fir::ExtendedValue is the returned Fortran intrinsic value. -fir::ExtendedValue genIntrinsicCall(fir::FirOpBuilder &builder, -mlir::Location loc, llvm::StringRef name, -std::optional resultType, -llvm::ArrayRef args, -StatementContext &stmtCtx); +fir::ExtendedValue +genIntrinsicCall(fir::FirOpBuilder &builder, mlir::Location loc, + llvm::StringRef name, std::optional resultType, + llvm::ArrayRef args, + StatementContext &stmtCtx, + Fortran::lower::AbstractConverter *converter = nullptr); } // namespace lower } // namespace Fortran diff --git a/flang/include/flang/Lower/LoweringOptions.def b/flang/include/flang/Lower/LoweringOptions.def index 2a89308467fd90..0ab7c5220d24c4 100644 --- a/flang/include/flang/Lower/LoweringOptions.def +++ b/flang/include/flang/Lower/LoweringOptions.def @@ -31,5 +31,8 @@ ENUM_LOWERINGOPT(PolymorphicTypeImpl, unsigned, 1, 0) /// Off by default until fully ready. ENUM_LOWERINGOPT(LowerToHighLevelFIR, unsigned, 1, 0) +/// If true, reverse PowerPC native vector element order. +ENUM_
[clang] 9f10cc2 - [OPENMP] [DOCS] fix section formatting issues [NFC]
Author: Kelvin Li Date: 2019-11-06T22:03:09-05:00 New Revision: 9f10cc2d124c275f2e7a6764e168f6b75527e78f URL: https://github.com/llvm/llvm-project/commit/9f10cc2d124c275f2e7a6764e168f6b75527e78f DIFF: https://github.com/llvm/llvm-project/commit/9f10cc2d124c275f2e7a6764e168f6b75527e78f.diff LOG: [OPENMP] [DOCS] fix section formatting issues [NFC] Differential Revision: https://reviews.llvm.org/D69909 Added: Modified: clang/docs/OpenMPSupport.rst Removed: diff --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst index b47a2b65d4f4..0ef4acf7631a 100644 --- a/clang/docs/OpenMPSupport.rst +++ b/clang/docs/OpenMPSupport.rst @@ -13,9 +13,8 @@ .. contents:: :local: -== OpenMP Support -== +== Clang fully supports OpenMP 4.5. Clang supports offloading to X86_64, AArch64, PPC64[LE] and has `basic support for Cuda devices`_. @@ -30,7 +29,7 @@ Interface (OMPT) on x86, x86_64, AArch64, and PPC64 on Linux, Windows, and macOS For the list of supported features from OpenMP 5.0 see `OpenMP implementation details`_. General improvements - + - New collapse clause scheme to avoid expensive remainder operations. Compute loop index variables after collapsing a loop nest via the collapse clause by replacing the expensive remainder operation with @@ -47,6 +46,13 @@ General improvements - Simplified SPMD code generation for `distribute parallel for` when the new default schedules are applicable. +- When using the collapse clause on a loop nest the default behavior + is to automatically extend the representation of the loop counter to + 64 bits for the cases where the sizes of the collapsed loops are not + known at compile time. To prevent this conservative choice and use + at most 32 bits, compile your program with the + `-fopenmp-optimistic-collapse`. + .. _basic support for Cuda devices: Cuda devices support @@ -77,15 +83,6 @@ are stored in the global memory. In `Cuda` mode local variables are not shared between the threads and it is user responsibility to share the required data between the threads in the parallel regions. -Collapsed loop nest counter - -When using the collapse clause on a loop nest the default behavior is to -automatically extend the representation of the loop counter to 64 bits for -the cases where the sizes of the collapsed loops are not known at compile -time. To prevent this conservative choice and use at most 32 bits, -compile your program with the `-fopenmp-optimistic-collapse`. - Features not supported or with limited support for Cuda devices --- @@ -112,7 +109,7 @@ Features not supported or with limited support for Cuda devices .. _OpenMP implementation details: OpenMP 5.0 Implementation Details -- += The following table provides a quick overview over various OpenMP 5.0 features and their implementation status. Please contact *openmp-dev* at ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] 0c7a1c0 - [OPENMP] [DOCS] correct status for use_device_addr clause
Author: Kelvin Li Date: 2019-11-22T15:32:40-05:00 New Revision: 0c7a1c0cfc2a4e5b8b7f3920b2797c12963b8384 URL: https://github.com/llvm/llvm-project/commit/0c7a1c0cfc2a4e5b8b7f3920b2797c12963b8384 DIFF: https://github.com/llvm/llvm-project/commit/0c7a1c0cfc2a4e5b8b7f3920b2797c12963b8384.diff LOG: [OPENMP] [DOCS] correct status for use_device_addr clause The status of the use_device_addr clause feature is changed from 'done' to 'worked on`. Differential Revision: https://reviews.llvm.org/D70608 Added: Modified: clang/docs/OpenMPSupport.rst Removed: diff --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst index aafadcfa0058..ee80f1afb9e6 100644 --- a/clang/docs/OpenMPSupport.rst +++ b/clang/docs/OpenMPSupport.rst @@ -205,7 +205,7 @@ implementation. +--+--+--+---+ | device extension | mapping lambda expression | :good:`done` | D51107 | +--+--+--+---+ -| device extension | clause: use_device_addr for target data | :good:`done` | | +| device extension | clause: use_device_addr for target data | :part:`worked on`| | +--+--+--+---+ | device extension | map(replicate) or map(local) when requires unified_shared_me | :part:`worked on`| D55719,D55892 | +--+--+--+---+ ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] ac43033 - [OpenMP] [DOCS] Update OMP5.0 feature status table [NFC]
Author: Kelvin Li Date: 2020-02-03T18:30:36-05:00 New Revision: ac430336318a1abe6e4726e8df49ee0e6b779691 URL: https://github.com/llvm/llvm-project/commit/ac430336318a1abe6e4726e8df49ee0e6b779691 DIFF: https://github.com/llvm/llvm-project/commit/ac430336318a1abe6e4726e8df49ee0e6b779691.diff LOG: [OpenMP] [DOCS] Update OMP5.0 feature status table [NFC] Differential Revision: https://reviews.llvm.org/D72901 Added: Modified: clang/docs/OpenMPSupport.rst Removed: diff --git a/clang/docs/OpenMPSupport.rst b/clang/docs/OpenMPSupport.rst index 3a28adb2f444..39988a33715c 100644 --- a/clang/docs/OpenMPSupport.rst +++ b/clang/docs/OpenMPSupport.rst @@ -191,9 +191,11 @@ implementation. +--+--+--+---+ | device extension | allow access to the reference count (omp_target_is_present) | :part:`worked on`| | +--+--+--+---+ -| device extension | requires directive (unified shared memory) | :good:`done` | | +| device extension | requires directive | :part:`partial` | | +--+--+--+---+ -| device extension | clause: unified_address, unified_shared_memory | :good:`done` | D52625,D52359 | +| device extension | clause: unified_shared_memory | :good:`done` | D52625,D52359 | ++--+--+--+---+ +| device extension | clause: unified_address | :part:`partial` | | +--+--+--+---+ | device extension | clause: reverse_offload | :none:`unclaimed parts` | D52780 | +--+--+--+---+ @@ -207,12 +209,14 @@ implementation. +--+--+--+---+ | device extension | clause: use_device_addr for target data | :part:`worked on`| | +--+--+--+---+ -| device extension | map(replicate) or map(local) when requires unified_shared_me | :part:`worked on`| D55719,D55892 | +| device extension | support close modifier on map clause | :good:`done` | D55719,D55892 | +--+--+--+---+ | device extension | teams construct on the host device | :part:`worked on`| Clang part is done, r371553. | +--+--+--+---+ | device extension
r289836 - Fix typo in comment. NFC.
Author: kli Date: Thu Dec 15 11:55:32 2016 New Revision: 289836 URL: http://llvm.org/viewvc/llvm-project?rev=289836&view=rev Log: Fix typo in comment. NFC. Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=289836&r1=289835&r2=289836&view=diff == --- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original) +++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Thu Dec 15 11:55:32 2016 @@ -3439,7 +3439,7 @@ static void emitCommonOMPTeamsDirective( } void CodeGenFunction::EmitOMPTeamsDirective(const OMPTeamsDirective &S) { - // Emit parallel region as a standalone region. + // Emit teams region as a standalone region. auto &&CodeGen = [&S](CodeGenFunction &CGF, PrePostActionTy &) { OMPPrivateScope PrivateScope(CGF); (void)CGF.EmitOMPFirstprivateClause(S, PrivateScope); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r289897 - Fix typo in error messages. NFC.
Author: kli Date: Thu Dec 15 18:15:54 2016 New Revision: 289897 URL: http://llvm.org/viewvc/llvm-project?rev=289897&view=rev Log: Fix typo in error messages. NFC. Modified: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_loop_messages.cpp Modified: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_loop_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_loop_messages.cpp?rev=289897&r1=289896&r2=289897&view=diff == --- cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_loop_messages.cpp (original) +++ cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_loop_messages.cpp Thu Dec 15 18:15:54 2016 @@ -659,12 +659,12 @@ void test_loop_eh() { try { // expected-error {{'try' statement cannot be used in OpenMP simd region}} for (int j = 0; j < 10; ++j) { if (a[i] > b[j]) - throw a[i]; // expected-error {{throw' statement cannot be used in OpenMP simd region}} + throw a[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}} } - throw a[i]; // expected-error {{throw' statement cannot be used in OpenMP simd region}} + throw a[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}} } catch (float f) { if (f > 0.1) -throw a[i]; // expected-error {{throw' statement cannot be used in OpenMP simd region}} +throw a[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}} return; // expected-error {{cannot return from OpenMP region}} } switch (i) { @@ -676,7 +676,7 @@ void test_loop_eh() { } for (int j = 0; j < 10; j++) { if (c[i] > 10) -throw c[i]; // expected-error {{throw' statement cannot be used in OpenMP simd region}} +throw c[i]; // expected-error {{'throw' statement cannot be used in OpenMP simd region}} } } if (c[9] > 10) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r289989 - [OpenMP] support the 'is_device_ptr' clause with 'target parallel' pragma
Author: kli Date: Fri Dec 16 14:50:46 2016 New Revision: 289989 URL: http://llvm.org/viewvc/llvm-project?rev=289989&view=rev Log: [OpenMP] support the 'is_device_ptr' clause with 'target parallel' pragma This patch is to add support of the 'is_device_ptr' clause in the 'target parallel' pragma. Differential Revision: https://reviews.llvm.org/D27821 Added: cfe/trunk/test/OpenMP/target_parallel_is_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_parallel_is_device_ptr_messages.cpp Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def cfe/trunk/lib/Sema/SemaOpenMP.cpp Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=289989&r1=289988&r2=289989&view=diff == --- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original) +++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Fri Dec 16 14:50:46 2016 @@ -451,7 +451,6 @@ OPENMP_TARGET_EXIT_DATA_CLAUSE(nowait) OPENMP_TARGET_EXIT_DATA_CLAUSE(depend) // Clauses allowed for OpenMP directive 'target parallel'. -// TODO: add target clauses 'is_device_ptr' OPENMP_TARGET_PARALLEL_CLAUSE(if) OPENMP_TARGET_PARALLEL_CLAUSE(device) OPENMP_TARGET_PARALLEL_CLAUSE(map) @@ -465,6 +464,7 @@ OPENMP_TARGET_PARALLEL_CLAUSE(default) OPENMP_TARGET_PARALLEL_CLAUSE(proc_bind) OPENMP_TARGET_PARALLEL_CLAUSE(shared) OPENMP_TARGET_PARALLEL_CLAUSE(reduction) +OPENMP_TARGET_PARALLEL_CLAUSE(is_device_ptr) // Clauses allowed for OpenMP directive 'target parallel for'. // TODO: add target clauses 'is_device_ptr' Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=289989&r1=289988&r2=289989&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Fri Dec 16 14:50:46 2016 @@ -7265,7 +7265,8 @@ OMPClause *Sema::ActOnOpenMPPrivateClaus // OpenMP 4.5 [2.15.5.1, Restrictions, p.3] // A list item cannot appear in both a map clause and a data-sharing // attribute clause on the same construct -if (DSAStack->getCurrentDirective() == OMPD_target) { +if (DSAStack->getCurrentDirective() == OMPD_target || +DSAStack->getCurrentDirective() == OMPD_target_parallel) { OpenMPClauseKind ConflictKind; if (DSAStack->checkMappableExprComponentListsForDecl( VD, /*CurrentRegionOnly=*/true, @@ -7522,7 +7523,7 @@ OMPClause *Sema::ActOnOpenMPFirstprivate // OpenMP 4.5 [2.15.5.1, Restrictions, p.3] // A list item cannot appear in both a map clause and a data-sharing // attribute clause on the same construct - if (CurrDir == OMPD_target) { + if (CurrDir == OMPD_target || CurrDir == OMPD_target_parallel) { OpenMPClauseKind ConflictKind; if (DSAStack->checkMappableExprComponentListsForDecl( VD, /*CurrentRegionOnly=*/true, Added: cfe/trunk/test/OpenMP/target_parallel_is_device_ptr_ast_print.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_is_device_ptr_ast_print.cpp?rev=289989&view=auto == --- cfe/trunk/test/OpenMP/target_parallel_is_device_ptr_ast_print.cpp (added) +++ cfe/trunk/test/OpenMP/target_parallel_is_device_ptr_ast_print.cpp Fri Dec 16 14:50:46 2016 @@ -0,0 +1,294 @@ +// RUN: %clang_cc1 -verify -fopenmp -std=c++11 -ast-print %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +struct ST { + int *a; +}; +typedef int arr[10]; +typedef ST STarr[10]; +struct SA { + const int da[5] = { 0 }; + ST g[10]; + STarr &rg = g; + int i; + int &j = i; + int *k = &j; + int *&z = k; + int aa[10]; + arr &raa = aa; + void func(int arg) { +#pragma omp target parallel is_device_ptr(k) +{} +#pragma omp target parallel is_device_ptr(z) +{} +#pragma omp target parallel is_device_ptr(aa) // OK +{} +#pragma omp target parallel is_device_ptr(raa) // OK +{} +#pragma omp target parallel is_device_ptr(g) // OK +{} +#pragma omp target parallel is_device_ptr(rg) // OK +{} +#pragma omp target parallel is_device_ptr(da) // OK +{} + return; + } +}; +// CHECK: struct SA +// CHECK-NEXT: const int da[5] = {0}; +// CHECK-NEXT: ST g[10]; +// CHECK-NEXT: STarr &rg = this->g; +// CHECK-NEXT: int i; +// CHECK-NEXT: int &j = this->i; +// CHECK-NEXT: int *k = &this->j; +// CHECK-NEXT: int *&z = this->k; +// CHECK-NEXT: int aa[10]; +// CHECK-NEXT: arr &raa = this->aa; +// CHECK-NEXT: func( +// CHECK-NEXT: #pragma omp target parallel is_device_ptr(this->k) +// CHECK-NEXT: { +// CHECK-NEXT: } +
r290673 - Fix format. NFC
Author: kli Date: Wed Dec 28 11:57:07 2016 New Revision: 290673 URL: http://llvm.org/viewvc/llvm-project?rev=290673&view=rev Log: Fix format. NFC Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=290673&r1=290672&r2=290673&view=diff == --- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original) +++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Wed Dec 28 11:57:07 2016 @@ -2005,17 +2005,20 @@ void CodeGenFunction::EmitOMPTeamsDistri void CodeGenFunction::EmitOMPTargetTeamsDirective( const OMPTargetTeamsDirective &S) { - CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_target_teams, - [&S](CodeGenFunction &CGF, PrePostActionTy &) { - CGF.EmitStmt(cast(S.getAssociatedStmt())->getCapturedStmt()); + CGM.getOpenMPRuntime().emitInlinedDirective( + *this, OMPD_target_teams, [&S](CodeGenFunction &CGF, PrePostActionTy &) { +CGF.EmitStmt( +cast(S.getAssociatedStmt())->getCapturedStmt()); }); } void CodeGenFunction::EmitOMPTargetTeamsDistributeDirective( const OMPTargetTeamsDistributeDirective &S) { - CGM.getOpenMPRuntime().emitInlinedDirective(*this, OMPD_target_teams_distribute, + CGM.getOpenMPRuntime().emitInlinedDirective( + *this, OMPD_target_teams_distribute, [&S](CodeGenFunction &CGF, PrePostActionTy &) { - CGF.EmitStmt(cast(S.getAssociatedStmt())->getCapturedStmt()); +CGF.EmitStmt( +cast(S.getAssociatedStmt())->getCapturedStmt()); }); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r290795 - Fix typo in test case. NFC
Author: kli Date: Sat Dec 31 17:36:47 2016 New Revision: 290795 URL: http://llvm.org/viewvc/llvm-project?rev=290795&view=rev Log: Fix typo in test case. NFC Modified: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_collapse_messages.cpp Modified: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_collapse_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_collapse_messages.cpp?rev=290795&r1=290794&r2=290795&view=diff == --- cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_collapse_messages.cpp (original) +++ cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_collapse_messages.cpp Sat Dec 31 17:36:47 2016 @@ -24,8 +24,8 @@ T tmain(T argc, S **argv) { //expected-n #pragma omp target #pragma omp teams distribute parallel for simd collapse ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (int i = ST; i < N; i++) - argv[0][i] = argv[0][i] - argv[0][i-ST]; + #pragma omp target #pragma omp teams distribute parallel for simd collapse () // expected-error {{expected expression}} for (int i = ST; i < N; i++) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r290813 - [OpenMP] Add test cases for the proc_bind and schedule clauses with 'teams distribute parallel for' pragma.
Author: kli Date: Mon Jan 2 10:42:11 2017 New Revision: 290813 URL: http://llvm.org/viewvc/llvm-project?rev=290813&view=rev Log: [OpenMP] Add test cases for the proc_bind and schedule clauses with 'teams distribute parallel for' pragma. https://reviews.llvm.org/D28205 Added: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_proc_bind_messages.cpp cfe/trunk/test/OpenMP/teams_distribute_parallel_for_schedule_messages.cpp Added: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_proc_bind_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_parallel_for_proc_bind_messages.cpp?rev=290813&view=auto == --- cfe/trunk/test/OpenMP/teams_distribute_parallel_for_proc_bind_messages.cpp (added) +++ cfe/trunk/test/OpenMP/teams_distribute_parallel_for_proc_bind_messages.cpp Mon Jan 2 10:42:11 2017 @@ -0,0 +1,85 @@ +// RUN: %clang_cc1 -verify -fopenmp %s + +void foo(); + +template +T tmain(T argc, S **argv) { + T i; +#pragma omp target +#pragma omp teams distribute parallel for proc_bind // expected-error {{expected '(' after 'proc_bind'}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for proc_bind( // expected-error {{expected 'master', 'close' or 'spread' in OpenMP clause 'proc_bind'}} expected-error {{expected ')'}} expected-note {{to match this '('}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for proc_bind() // expected-error {{expected 'master', 'close' or 'spread' in OpenMP clause 'proc_bind'}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for proc_bind(master // expected-error {{expected ')'}} expected-note {{to match this '('}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for proc_bind(close), proc_bind(spread) // expected-error {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'proc_bind' clause}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for proc_bind(x) // expected-error {{expected 'master', 'close' or 'spread' in OpenMP clause 'proc_bind'}} + for (i = 0; i < argc; ++i) +foo(); + +#pragma omp target +#pragma omp teams distribute parallel for proc_bind(master) + for (i = 0; i < argc; ++i) +foo(); + +#pragma omp parallel proc_bind(close) +#pragma omp target +#pragma omp teams distribute parallel for proc_bind(spread) + for (i = 0; i < argc; ++i) +foo(); + + return T(); +} + +int main(int argc, char **argv) { + int i; +#pragma omp target +#pragma omp teams distribute parallel for proc_bind // expected-error {{expected '(' after 'proc_bind'}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for proc_bind( // expected-error {{expected 'master', 'close' or 'spread' in OpenMP clause 'proc_bind'}} expected-error {{expected ')'}} expected-note {{to match this '('}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for proc_bind() // expected-error {{expected 'master', 'close' or 'spread' in OpenMP clause 'proc_bind'}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for proc_bind(master // expected-error {{expected ')'}} expected-note {{to match this '('}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for proc_bind(close), proc_bind(spread) // expected-error {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'proc_bind' clause}} + for (i = 0; i < argc; ++i) +foo(); +#pragma omp target +#pragma omp teams distribute parallel for proc_bind(x) // expected-error {{expected 'master', 'close' or 'spread' in OpenMP clause 'proc_bind'}} + for (i = 0; i < argc; ++i) +foo(); + +#pragma omp target +#pragma omp teams distribute parallel for proc_bind(master) + for (i = 0; i < argc; ++i) +foo(); + +#pragma omp parallel proc_bind(close) +#pragma omp target +#pragma omp teams distribute parallel for proc_bind(spread) + for (i = 0; i < argc; ++i) +foo(); + return tmain(argc, argv); +} Added: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_schedule_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_parallel_for_schedule_messages.cpp?rev=290813&view=auto == --- cfe/trunk/test/OpenMP/teams_distribute_parallel_for_schedule_messages.cpp (added) +++ cfe/trunk/test/OpenMP/teams_distribute_parallel_for_schedule_messages.cpp Mon Jan 2 10:42:11 2017 @@ -0,0 +1,172 @@ +// RUN: %clang_cc1 -verify -fopenmp %s + +void foo() { +} + +bool foobool(int argc) { + return argc; +} + +struct
r291260 - [OpenMP] fix typo - the standalone 'distribute' pragma should be 'teams distribute' pragma
Author: kli Date: Fri Jan 6 12:49:49 2017 New Revision: 291260 URL: http://llvm.org/viewvc/llvm-project?rev=291260&view=rev Log: [OpenMP] fix typo - the standalone 'distribute' pragma should be 'teams distribute' pragma Modified: cfe/trunk/test/OpenMP/teams_distribute_collapse_messages.cpp Modified: cfe/trunk/test/OpenMP/teams_distribute_collapse_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_collapse_messages.cpp?rev=291260&r1=291259&r2=291260&view=diff == --- cfe/trunk/test/OpenMP/teams_distribute_collapse_messages.cpp (original) +++ cfe/trunk/test/OpenMP/teams_distribute_collapse_messages.cpp Fri Jan 6 12:49:49 2017 @@ -66,7 +66,8 @@ T tmain(T argc, S **argv) { //expected-n for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; -#pragma omp distribute collapse (S) // expected-error {{'S' does not refer to a value}} +#pragma omp target +#pragma omp teams distribute collapse (S) // expected-error {{'S' does not refer to a value}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r291537 - [OpenMP] Support the 'is_device_ptr' clause with 'target parallel for simd' pragma
Author: kli Date: Mon Jan 9 22:26:44 2017 New Revision: 291537 URL: http://llvm.org/viewvc/llvm-project?rev=291537&view=rev Log: [OpenMP] Support the 'is_device_ptr' clause with 'target parallel for simd' pragma This patch is to add support of the 'is_device_ptr' clause with the 'target parallel for simd' pragma. Differential Revision: https://reviews.llvm.org/D28402 Added: cfe/trunk/test/OpenMP/target_parallel_for_simd_is_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_parallel_for_simd_is_device_ptr_messages.cpp Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def cfe/trunk/lib/Sema/SemaOpenMP.cpp Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=291537&r1=291536&r2=291537&view=diff == --- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original) +++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Mon Jan 9 22:26:44 2017 @@ -633,7 +633,6 @@ OPENMP_DISTRIBUTE_SIMD_CLAUSE(simdlen) OPENMP_DISTRIBUTE_SIMD_CLAUSE(reduction) // Clauses allowed for OpenMP directive 'target parallel for simd'. -// TODO: add target clauses 'is_device_ptr' OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(if) OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(device) OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(map) @@ -655,6 +654,7 @@ OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(l OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(safelen) OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(simdlen) OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(aligned) +OPENMP_TARGET_PARALLEL_FOR_SIMD_CLAUSE(is_device_ptr) // Clauses allowed for OpenMP directive 'target simd'. OPENMP_TARGET_SIMD_CLAUSE(if) Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=291537&r1=291536&r2=291537&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Mon Jan 9 22:26:44 2017 @@ -7451,7 +7451,8 @@ OMPClause *Sema::ActOnOpenMPPrivateClaus CurrDir == OMPD_target_teams || CurrDir == OMPD_target_teams_distribute || CurrDir == OMPD_target_teams_distribute_parallel_for || -CurrDir == OMPD_target_teams_distribute_parallel_for_simd) { +CurrDir == OMPD_target_teams_distribute_parallel_for_simd || +CurrDir == OMPD_target_parallel_for_simd) { OpenMPClauseKind ConflictKind; if (DSAStack->checkMappableExprComponentListsForDecl( VD, /*CurrentRegionOnly=*/true, @@ -7712,7 +7713,8 @@ OMPClause *Sema::ActOnOpenMPFirstprivate CurrDir == OMPD_target_teams || CurrDir == OMPD_target_teams_distribute || CurrDir == OMPD_target_teams_distribute_parallel_for || - CurrDir == OMPD_target_teams_distribute_parallel_for_simd) { + CurrDir == OMPD_target_teams_distribute_parallel_for_simd || + CurrDir == OMPD_target_parallel_for_simd) { OpenMPClauseKind ConflictKind; if (DSAStack->checkMappableExprComponentListsForDecl( VD, /*CurrentRegionOnly=*/true, Added: cfe/trunk/test/OpenMP/target_parallel_for_simd_is_device_ptr_ast_print.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_for_simd_is_device_ptr_ast_print.cpp?rev=291537&view=auto == --- cfe/trunk/test/OpenMP/target_parallel_for_simd_is_device_ptr_ast_print.cpp (added) +++ cfe/trunk/test/OpenMP/target_parallel_for_simd_is_device_ptr_ast_print.cpp Mon Jan 9 22:26:44 2017 @@ -0,0 +1,318 @@ +// RUN: %clang_cc1 -verify -fopenmp -std=c++11 -ast-print %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER +struct ST { + int *a; +}; +typedef int arr[10]; +typedef ST STarr[10]; +struct SA { + const int da[5] = { 0 }; + ST g[10]; + STarr &rg = g; + int i; + int &j = i; + int *k = &j; + int *&z = k; + int aa[10]; + arr &raa = aa; + void func(int arg) { +#pragma omp target parallel for simd is_device_ptr(k) + for (int i=0; i<100; i++) +; +#pragma omp target parallel for simd is_device_ptr(z) + for (int i=0; i<100; i++) +; +#pragma omp target parallel for simd is_device_ptr(aa) // OK + for (int i=0; i<100; i++) +; +#pragma omp target parallel for simd is_device_ptr(raa) // OK + for (int i=0; i<100; i++) +; +#pragma omp target parallel for simd is_device_ptr(g) // OK + for (int i=0; i<100; i++) +; +#pragma omp target parallel for simd is_device_ptr(rg) // OK + for (int i=0; i<100; i++) +; +#pragma omp target parallel for simd is_device_ptr(da) // OK + for (int i=0; i<100; i++) +; + ret
r291540 - [OpenMP] Support the 'is_device_ptr' clause with 'target parallel for' pragma
Author: kli Date: Mon Jan 9 23:15:35 2017 New Revision: 291540 URL: http://llvm.org/viewvc/llvm-project?rev=291540&view=rev Log: [OpenMP] Support the 'is_device_ptr' clause with 'target parallel for' pragma This patch is to add support of the 'is_device_ptr' clause with the 'target parallel for' pragma. Differential Revision: https://reviews.llvm.org/D28255 Added: cfe/trunk/test/OpenMP/target_parallel_for_is_device_ptr_ast_print.cpp cfe/trunk/test/OpenMP/target_parallel_for_is_device_ptr_messages.cpp Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def cfe/trunk/lib/Sema/SemaOpenMP.cpp Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=291540&r1=291539&r2=291540&view=diff == --- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original) +++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Mon Jan 9 23:15:35 2017 @@ -483,7 +483,6 @@ OPENMP_TARGET_PARALLEL_CLAUSE(reduction) OPENMP_TARGET_PARALLEL_CLAUSE(is_device_ptr) // Clauses allowed for OpenMP directive 'target parallel for'. -// TODO: add target clauses 'is_device_ptr' OPENMP_TARGET_PARALLEL_FOR_CLAUSE(if) OPENMP_TARGET_PARALLEL_FOR_CLAUSE(device) OPENMP_TARGET_PARALLEL_FOR_CLAUSE(map) @@ -502,6 +501,7 @@ OPENMP_TARGET_PARALLEL_FOR_CLAUSE(collap OPENMP_TARGET_PARALLEL_FOR_CLAUSE(schedule) OPENMP_TARGET_PARALLEL_FOR_CLAUSE(ordered) OPENMP_TARGET_PARALLEL_FOR_CLAUSE(linear) +OPENMP_TARGET_PARALLEL_FOR_CLAUSE(is_device_ptr) // Clauses allowed for OpenMP directive 'target update'. // TODO More clauses for 'target update' directive. Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=291540&r1=291539&r2=291540&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Mon Jan 9 23:15:35 2017 @@ -7452,7 +7452,8 @@ OMPClause *Sema::ActOnOpenMPPrivateClaus CurrDir == OMPD_target_teams_distribute || CurrDir == OMPD_target_teams_distribute_parallel_for || CurrDir == OMPD_target_teams_distribute_parallel_for_simd || -CurrDir == OMPD_target_parallel_for_simd) { +CurrDir == OMPD_target_parallel_for_simd || +CurrDir == OMPD_target_parallel_for) { OpenMPClauseKind ConflictKind; if (DSAStack->checkMappableExprComponentListsForDecl( VD, /*CurrentRegionOnly=*/true, @@ -7714,7 +7715,8 @@ OMPClause *Sema::ActOnOpenMPFirstprivate CurrDir == OMPD_target_teams_distribute || CurrDir == OMPD_target_teams_distribute_parallel_for || CurrDir == OMPD_target_teams_distribute_parallel_for_simd || - CurrDir == OMPD_target_parallel_for_simd) { + CurrDir == OMPD_target_parallel_for_simd || + CurrDir == OMPD_target_parallel_for) { OpenMPClauseKind ConflictKind; if (DSAStack->checkMappableExprComponentListsForDecl( VD, /*CurrentRegionOnly=*/true, Added: cfe/trunk/test/OpenMP/target_parallel_for_is_device_ptr_ast_print.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_for_is_device_ptr_ast_print.cpp?rev=291540&view=auto == --- cfe/trunk/test/OpenMP/target_parallel_for_is_device_ptr_ast_print.cpp (added) +++ cfe/trunk/test/OpenMP/target_parallel_for_is_device_ptr_ast_print.cpp Mon Jan 9 23:15:35 2017 @@ -0,0 +1,315 @@ +// RUN: %clang_cc1 -verify -fopenmp -std=c++11 -ast-print %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +void foo() {} + +struct ST { + int *a; +}; +typedef int arr[10]; +typedef ST STarr[10]; +struct SA { + const int da[5] = { 0 }; + ST g[10]; + STarr &rg = g; + int i; + int &j = i; + int *k = &j; + int *&z = k; + int aa[10]; + arr &raa = aa; + void func(int arg) { +#pragma omp target parallel for is_device_ptr(k) +for (int i=0; i<100; i++) foo(); + +#pragma omp target parallel for is_device_ptr(z) +for (int i=0; i<100; i++) foo(); + +#pragma omp target parallel for is_device_ptr(aa) // OK +for (int i=0; i<100; i++) foo(); + +#pragma omp target parallel for is_device_ptr(raa) // OK +for (int i=0; i<100; i++) foo(); + +#pragma omp target parallel for is_device_ptr(g) // OK +for (int i=0; i<100; i++) foo(); + +#pragma omp target parallel for is_device_ptr(rg) // OK +for (int i=0; i<100; i++) foo(); + +#pragma omp target parallel for is_device_ptr(da) // OK +for (int i=0; i<100; i++) foo(); + +return; + } +}; +// CHECK: struct SA +// CHECK-NEXT: const i
r291583 - [OpenMP] Remove outdated comments. NFC.
Author: kli Date: Tue Jan 10 12:57:07 2017 New Revision: 291583 URL: http://llvm.org/viewvc/llvm-project?rev=291583&view=rev Log: [OpenMP] Remove outdated comments. NFC. Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=291583&r1=291582&r2=291583&view=diff == --- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original) +++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Tue Jan 10 12:57:07 2017 @@ -450,7 +450,6 @@ OPENMP_TARGET_CLAUSE(firstprivate) OPENMP_TARGET_CLAUSE(is_device_ptr) // Clauses allowed for OpenMP directive 'target data'. -// TODO More clauses for 'target data' directive. OPENMP_TARGET_DATA_CLAUSE(if) OPENMP_TARGET_DATA_CLAUSE(device) OPENMP_TARGET_DATA_CLAUSE(map) @@ -508,7 +507,6 @@ OPENMP_TARGET_PARALLEL_FOR_CLAUSE(linear OPENMP_TARGET_PARALLEL_FOR_CLAUSE(is_device_ptr) // Clauses allowed for OpenMP directive 'target update'. -// TODO More clauses for 'target update' directive. OPENMP_TARGET_UPDATE_CLAUSE(if) OPENMP_TARGET_UPDATE_CLAUSE(device) OPENMP_TARGET_UPDATE_CLAUSE(to) @@ -517,7 +515,6 @@ OPENMP_TARGET_UPDATE_CLAUSE(nowait) OPENMP_TARGET_UPDATE_CLAUSE(depend) // Clauses allowed for OpenMP directive 'teams'. -// TODO More clauses for 'teams' directive. OPENMP_TEAMS_CLAUSE(default) OPENMP_TEAMS_CLAUSE(private) OPENMP_TEAMS_CLAUSE(firstprivate) @@ -527,7 +524,6 @@ OPENMP_TEAMS_CLAUSE(num_teams) OPENMP_TEAMS_CLAUSE(thread_limit) // Clauses allowed for OpenMP directive 'ordered'. -// TODO More clauses for 'ordered' directive. OPENMP_ORDERED_CLAUSE(threads) OPENMP_ORDERED_CLAUSE(simd) OPENMP_ORDERED_CLAUSE(depend) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r288838 - [OpenMP] Fix typo in the test case. NFC.
Author: kli Date: Tue Dec 6 12:50:20 2016 New Revision: 288838 URL: http://llvm.org/viewvc/llvm-project?rev=288838&view=rev Log: [OpenMP] Fix typo in the test case. NFC. Modified: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_if_messages.cpp Modified: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_if_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_if_messages.cpp?rev=288838&r1=288837&r2=288838&view=diff == --- cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_if_messages.cpp (original) +++ cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_if_messages.cpp Tue Dec 6 12:50:20 2016 @@ -16,8 +16,7 @@ int tmain(T argc, S **argv) { #pragma omp teams distribute parallel for simd if // expected-error {{expected '(' after 'if'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target -#pragma omp teams -#pragma omp distribute parallel for simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp teams distribute parallel for simd if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (i = 0; i < argc; ++i) foo(); #pragma omp target #pragma omp teams distribute parallel for simd if () // expected-error {{expected expression}} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r288862 - [OpenMP] Fix typo in the run command in the test case. NFC.
Author: kli Date: Tue Dec 6 17:18:06 2016 New Revision: 288862 URL: http://llvm.org/viewvc/llvm-project?rev=288862&view=rev Log: [OpenMP] Fix typo in the run command in the test case. NFC. Modified: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp Modified: cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp?rev=288862&r1=288861&r2=288862&view=diff == --- cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp (original) +++ cfe/trunk/test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp Tue Dec 6 17:18:06 2016 @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s -// rUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s -// rUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s +// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s // expected-no-diagnostics #ifndef HEADER ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r289657 - Fix assert message. NFC.
Author: kli Date: Wed Dec 14 09:39:58 2016 New Revision: 289657 URL: http://llvm.org/viewvc/llvm-project?rev=289657&view=rev Log: Fix assert message. NFC. Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=289657&r1=289656&r2=289657&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Wed Dec 14 09:39:58 2016 @@ -10808,7 +10808,7 @@ OMPClause *Sema::ActOnOpenMPIsDevicePtrC SourceLocation EndLoc) { MappableVarListInfo MVLI(VarList); for (auto &RefExpr : VarList) { -assert(RefExpr && "NULL expr in OpenMP use_device_ptr clause."); +assert(RefExpr && "NULL expr in OpenMP is_device_ptr clause."); SourceLocation ELoc; SourceRange ERange; Expr *SimpleRefExpr = RefExpr; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23528: [OpenMP] Sema and parsing for 'teams distribute simd' pragma
The failure cannot be reproduced. I re-apply r279045. Committed revision 285066. Thanks, Kelvin On Thu, Aug 18, 2016 at 5:46 AM, Diana Picus wrote: > Hi, > > I had to revert this (r279045) because it breaks some of our buildbots > (e.g. > clang-cmake-aarch64-quick, clang-x86_64-linux-selfhost-modules). > > The error is in OpenMP/teams_distribute_simd_ast_print.cpp: > clang: /home/buildslave/buildslave/clang-cmake-aarch64-quick/llvm/ > include/llvm/ADT/DenseMap.h:527: > bool llvm::DenseMapBase BucketT>::LookupBucketFor(const LookupKeyT&, const BucketT*&) const > [with LookupKeyT = clang::Stmt*; DerivedT = llvm::DenseMap long unsigned int>; > KeyT = clang::Stmt*; ValueT = long unsigned int; > KeyInfoT = llvm::DenseMapInfo; > BucketT = llvm::detail::DenseMapPair int>]: > > Assertion `!KeyInfoT::isEqual(Val, EmptyKey) && !KeyInfoT::isEqual(Val, > TombstoneKey) && > "Empty/Tombstone value shouldn't be inserted into map!"' failed. > > On 18 August 2016 at 02:21, Phabricator via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> This revision was automatically updated to reflect the committed changes. >> Closed by commit rL279003: [OpenMP] Sema and parsing for 'teams >> distribute simd’ pragma (authored by kli). >> >> Changed prior to commit: >> https://reviews.llvm.org/D23528?vs=68216&id=68448#toc >> >> Repository: >> rL LLVM >> >> https://reviews.llvm.org/D23528 >> >> Files: >> cfe/trunk/include/clang-c/Index.h >> cfe/trunk/include/clang/AST/RecursiveASTVisitor.h >> cfe/trunk/include/clang/AST/StmtOpenMP.h >> cfe/trunk/include/clang/Basic/OpenMPKinds.def >> cfe/trunk/include/clang/Basic/StmtNodes.td >> cfe/trunk/include/clang/Sema/Sema.h >> cfe/trunk/include/clang/Serialization/ASTBitCodes.h >> cfe/trunk/lib/AST/StmtOpenMP.cpp >> cfe/trunk/lib/AST/StmtPrinter.cpp >> cfe/trunk/lib/AST/StmtProfile.cpp >> cfe/trunk/lib/Basic/OpenMPKinds.cpp >> cfe/trunk/lib/CodeGen/CGStmt.cpp >> cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp >> cfe/trunk/lib/CodeGen/CodeGenFunction.h >> cfe/trunk/lib/Parse/ParseOpenMP.cpp >> cfe/trunk/lib/Sema/SemaOpenMP.cpp >> cfe/trunk/lib/Sema/TreeTransform.h >> cfe/trunk/lib/Serialization/ASTReaderStmt.cpp >> cfe/trunk/lib/Serialization/ASTWriterStmt.cpp >> cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp >> cfe/trunk/test/OpenMP/nesting_of_regions.cpp >> cfe/trunk/test/OpenMP/teams_distribute_simd_aligned_messages.cpp >> cfe/trunk/test/OpenMP/teams_distribute_simd_ast_print.cpp >> cfe/trunk/test/OpenMP/teams_distribute_simd_collapse_messages.cpp >> cfe/trunk/test/OpenMP/teams_distribute_simd_default_messages.cpp >> cfe/trunk/test/OpenMP/teams_distribute_simd_dist_schedule_messages.cpp >> cfe/trunk/test/OpenMP/teams_distribute_simd_firstprivate_messages.cpp >> cfe/trunk/test/OpenMP/teams_distribute_simd_lastprivate_messages.cpp >> cfe/trunk/test/OpenMP/teams_distribute_simd_linear_messages.cpp >> cfe/trunk/test/OpenMP/teams_distribute_simd_loop_messages.cpp >> cfe/trunk/test/OpenMP/teams_distribute_simd_messages.cpp >> cfe/trunk/test/OpenMP/teams_distribute_simd_num_teams_messages.cpp >> cfe/trunk/test/OpenMP/teams_distribute_simd_private_messages.cpp >> cfe/trunk/test/OpenMP/teams_distribute_simd_reduction_messages.cpp >> cfe/trunk/test/OpenMP/teams_distribute_simd_safelen_messages.cpp >> cfe/trunk/test/OpenMP/teams_distribute_simd_shared_messages.cpp >> cfe/trunk/test/OpenMP/teams_distribute_simd_simdlen_messages.cpp >> cfe/trunk/test/OpenMP/teams_distribute_simd_thread_limit_messages.cpp >> cfe/trunk/tools/libclang/CIndex.cpp >> cfe/trunk/tools/libclang/CXCursor.cpp >> >> >> ___ >> cfe-commits mailing list >> cfe-commits@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >> >> > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r247503 - Test commit.
Author: kli Date: Sat Sep 12 08:35:31 2015 New Revision: 247503 URL: http://llvm.org/viewvc/llvm-project?rev=247503&view=rev Log: Test commit. Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=247503&r1=247502&r2=247503&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Sat Sep 12 08:35:31 2015 @@ -7193,6 +7193,5 @@ OMPClause *Sema::ActOnOpenMPDeviceClause return nullptr; } } - return new (Context) OMPDeviceClause(ValExpr, StartLoc, LParenLoc, EndLoc); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D11619: [OPENMP] allow static local variable on data-sharing attribute clause
kkwli0 added a comment. Committed revision 247715. http://reviews.llvm.org/D11619 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12152: [OPENMP] Info about OpenMP Support in Users Manual
kkwli0 added inline comments. Comment at: docs/UsersManual.rst:1860 @@ +1859,3 @@ + +Clang fully implements all of standard OpenMP 3.1 directives and clauses + some +features of OpenMP 4.0, including ``#pragma omp simd``, Clang supports all OpenMP 3.1 directives and clauses. In addition, some features of OpenMP 4.0 are supported. For example, ''#pragma omp simd'', ..., and ''#pragma omp taskgroup'' directives. Comment at: docs/UsersManual.rst:1868 @@ +1867,3 @@ + +OpenMP support is disabled by default. Use option::`-fopenmp=libomp` to enable +it. Support for OpenMP can be disabled with :option:`-fno-openmp`. Should it be :option:`-fopenmp=libomp`? http://reviews.llvm.org/D12152 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D14134: [OpenMP] Parsing and sema support for map clause
kkwli0 created this revision. kkwli0 added reviewers: ABataev, rsmith, hfinkel, sfantao, fraggamuffin. kkwli0 added a subscriber: cfe-commits. This patch is to add parsing and sema support for map clause. This includes the new map types and the map type modifier added in OpenMP 4.5. http://reviews.llvm.org/D14134 Files: include/clang/AST/DataRecursiveASTVisitor.h include/clang/AST/OpenMPClause.h include/clang/AST/RecursiveASTVisitor.h include/clang/Basic/DiagnosticParseKinds.td include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/OpenMPKinds.def include/clang/Basic/OpenMPKinds.h include/clang/Sema/Sema.h lib/AST/OpenMPClause.cpp lib/AST/StmtPrinter.cpp lib/AST/StmtProfile.cpp lib/Basic/OpenMPKinds.cpp lib/CodeGen/CGStmtOpenMP.cpp lib/Parse/ParseOpenMP.cpp lib/Sema/SemaOpenMP.cpp lib/Sema/TreeTransform.h lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp test/OpenMP/target_map_messages.cpp tools/libclang/CIndex.cpp Index: tools/libclang/CIndex.cpp === --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -2171,6 +2171,9 @@ void OMPClauseEnqueue::VisitOMPDependClause(const OMPDependClause *C) { VisitOMPClauseList(C); } +void OMPClauseEnqueue::VisitOMPMapClause(const OMPMapClause *C) { + VisitOMPClauseList(C); +} } void EnqueueVisitor::EnqueueChildren(const OMPClause *S) { Index: test/OpenMP/target_map_messages.cpp === --- /dev/null +++ test/OpenMP/target_map_messages.cpp @@ -0,0 +1,119 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s + +void foo() { +} + +bool foobool(int argc) { + return argc; +} + +struct S1; // expected-note {{declared here}} +extern S1 a; +class S2 { + mutable int a; +public: + S2():a(0) { } + S2(S2 &s2):a(s2.a) { } + static float S2s; // expected-note 2 {{mappable type cannot contain static members}} + static const float S2sc; // expected-note 2 {{mappable type cannot contain static members}} +}; +const float S2::S2sc = 0; +const S2 b; +const S2 ba[5]; +class S3 { + int a; +public: + S3():a(0) { } + S3(S3 &s3):a(s3.a) { } +}; +const S3 c; +const S3 ca[5]; +extern const int f; +class S4 { + int a; + S4(); + S4(const S4 &s4); +public: + S4(int v):a(v) { } +}; +class S5 { + int a; + S5():a(0) {} + S5(const S5 &s5):a(s5.a) { } +public: + S5(int v):a(v) { } +}; + +S3 h; +#pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}} + +int main(int argc, char **argv) { + const int d = 5; + const int da[5] = { 0 }; + S4 e(4); + S5 g(5); + int i; + int &j = i; + int *k = &j; + int x; + int y; + int to, tofrom, always; + const int (&l)[5] = da; + #pragma omp target map // expected-error {{expected '(' after 'map'}} + #pragma omp target map ( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} + #pragma omp target map () // expected-error {{expected expression}} + #pragma omp target map (alloc) // expected-error {{use of undeclared identifier 'alloc'}} + #pragma omp target map (to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}} + #pragma omp target map (to:) // expected-error {{expected expression}} + #pragma omp target map (from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp target map (x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} + #pragma omp target map (x) + foo(); + #pragma omp target map (to: x) + foo(); + #pragma omp target map (to: to) + foo(); + #pragma omp target map (to) + foo(); + #pragma omp target map (to, x) + foo(); + #pragma omp target map (to x) // expected-error {{expected ',' or ')' in 'map' clause}} + #pragma omp target map (tofrom: argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name, array element or array section}} + #pragma omp target map (argc) + #pragma omp target map (S1) // expected-error {{'S1' does not refer to a value}} + #pragma omp target map (a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}} + #pragma omp target map (argv[1]) + #pragma omp target map(ba) // expected-error 2 {{type 'S2' is not mappable to target}} + #pragma omp target map(ca) + #pragma omp target map(da) + #pragma omp target map(S2::S2s) + #pragma omp target map(S2::S2sc) + #pragma omp target map(e, g) + #pragma omp target map(h) // expected-error {{threadprivate variables are not allowed in map clause}} + #pragma omp target map(k), map(k) // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}} + #pragma omp target m
Re: [PATCH] D14134: [OpenMP] Parsing and sema support for map clause
kkwli0 added a comment. Ping http://reviews.llvm.org/D14134 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D14134: [OpenMP] Parsing and sema support for map clause
kkwli0 marked 13 inline comments as done. kkwli0 added a comment. http://reviews.llvm.org/D14134 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r275926 - [OpenMP] Fix incorrect diagnostics in map clause
Author: kli Date: Mon Jul 18 17:49:16 2016 New Revision: 275926 URL: http://llvm.org/viewvc/llvm-project?rev=275926&view=rev Log: [OpenMP] Fix incorrect diagnostics in map clause Having the following code pattern will result in incorrect diagnostic int main() { int arr[10]; #pragma omp target data map(arr[:]) #pragma omp target map(arr) {} } t.cpp:4:24: error: original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage #pragma omp target map(arr) ^~~ t.cpp:3:29: note: used here #pragma omp target data map(arr[:]) ^~ 1 error generated. Patch by David S. Differential Revision: https://reviews.llvm.org/D22075 Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/test/OpenMP/target_map_messages.cpp cfe/trunk/test/OpenMP/target_parallel_for_map_messages.cpp cfe/trunk/test/OpenMP/target_parallel_for_simd_map_messages.cpp cfe/trunk/test/OpenMP/target_parallel_map_messages.cpp Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=275926&r1=275925&r2=275926&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Mon Jul 18 17:49:16 2016 @@ -10680,6 +10680,25 @@ static bool CheckMapConflicts( if (CI->getAssociatedDeclaration() != SI->getAssociatedDeclaration()) break; } +// Check if the extra components of the expressions in the enclosing +// data environment are redundant for the current base declaration. +// If they are, the maps completely overlap, which is legal. +for (; SI != SE; ++SI) { + QualType Type; + if (auto *ASE = + dyn_cast(SI->getAssociatedExpression())) { +Type = ASE->getBase()->IgnoreParenImpCasts()->getType(); + } else if (auto *OASE = + dyn_cast(SI->getAssociatedExpression())) { +auto *E = OASE->getBase()->IgnoreParenImpCasts(); +Type = +OMPArraySectionExpr::getBaseOriginalType(E).getCanonicalType(); + } + if (Type.isNull() || Type->isAnyPointerType() || + CheckArrayExpressionDoesNotReferToWholeSize( + SemaRef, SI->getAssociatedExpression(), Type)) +break; +} // OpenMP 4.5 [2.15.5.1, map Clause, Restrictions, p.4] // List items of map clauses in the same construct must not share Modified: cfe/trunk/test/OpenMP/target_map_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_map_messages.cpp?rev=275926&r1=275925&r2=275926&view=diff == --- cfe/trunk/test/OpenMP/target_map_messages.cpp (original) +++ cfe/trunk/test/OpenMP/target_map_messages.cpp Mon Jul 18 17:49:16 2016 @@ -284,6 +284,11 @@ void SAclient(int arg) { {} } } + #pragma omp target data map(marr[:][:][:]) + { +#pragma omp target data map(marr) +{} + } #pragma omp target data map(to: t) { @@ -419,10 +424,10 @@ T tmain(T argc) { #pragma omp target data map(j) #pragma omp target map(l) map(l[:5]) // expected-error 2 {{variable already marked as mapped in current construct}} expected-note 2 {{used here}} foo(); -#pragma omp target data map(k[:4], j, l[:5]) // expected-note 4 {{used here}} +#pragma omp target data map(k[:4], j, l[:5]) // expected-note 2 {{used here}} #pragma omp target data map(k) // expected-error 2 {{pointer cannot be mapped along with a section derived from itself}} #pragma omp target data map(j) -#pragma omp target map(l) // expected-error 2 {{original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage}} +#pragma omp target map(l) foo(); #pragma omp target data map(always, tofrom: x) @@ -488,10 +493,10 @@ int main(int argc, char **argv) { #pragma omp target data map(j) #pragma omp target map(l) map(l[:5]) // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}} foo(); -#pragma omp target data map(k[:4], j, l[:5]) // expected-note 2 {{used here}} +#pragma omp target data map(k[:4], j, l[:5]) // expected-note {{used here}} #pragma omp target data map(k) // expected-error {{pointer cannot be mapped along with a section derived from itself}} #pragma omp target data map(j) -#pragma omp target map(l) // expected-error {{original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage}} +#pragma omp target map(l) foo(); #pragma omp target data map(always, tofrom: x) Modified: cfe/trunk/test/OpenMP/target_parallel_for_map_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk
r276167 - [OpenMP] Ignore parens in atomic capture
Author: kli Date: Wed Jul 20 14:41:17 2016 New Revision: 276167 URL: http://llvm.org/viewvc/llvm-project?rev=276167&view=rev Log: [OpenMP] Ignore parens in atomic capture Clang misdiagnoses atomic captures cases that contains parens. i.e. int v, int *p; #pragma omp atomic capture { v = (*p); (*p)++; } Patch by David S. Differential Revision: https://reviews.llvm.org/D22487 Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/test/OpenMP/atomic_messages.c cfe/trunk/test/OpenMP/atomic_messages.cpp Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=276167&r1=276166&r2=276167&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Wed Jul 20 14:41:17 2016 @@ -6163,7 +6163,7 @@ bool OpenMPAtomicUpdateChecker::checkSta AtomicCompAssignOp->getOpcode()); OpLoc = AtomicCompAssignOp->getOperatorLoc(); E = AtomicCompAssignOp->getRHS(); -X = AtomicCompAssignOp->getLHS(); +X = AtomicCompAssignOp->getLHS()->IgnoreParens(); IsXLHSInRHSPart = true; } else if (auto *AtomicBinOp = dyn_cast( AtomicBody->IgnoreParenImpCasts())) { @@ -6177,7 +6177,7 @@ bool OpenMPAtomicUpdateChecker::checkSta IsPostfixUpdate = AtomicUnaryOp->isPostfix(); Op = AtomicUnaryOp->isIncrementOp() ? BO_Add : BO_Sub; OpLoc = AtomicUnaryOp->getOperatorLoc(); - X = AtomicUnaryOp->getSubExpr(); + X = AtomicUnaryOp->getSubExpr()->IgnoreParens(); E = SemaRef.ActOnIntegerConstant(OpLoc, /*uint64_t Val=*/1).get(); IsXLHSInRHSPart = true; } else { Modified: cfe/trunk/test/OpenMP/atomic_messages.c URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/atomic_messages.c?rev=276167&r1=276166&r2=276167&view=diff == --- cfe/trunk/test/OpenMP/atomic_messages.c (original) +++ cfe/trunk/test/OpenMP/atomic_messages.c Wed Jul 20 14:41:17 2016 @@ -313,6 +313,8 @@ int captureint() { #pragma omp atomic capture {c = a; a++;} #pragma omp atomic capture + {c = a; (a)++;} +#pragma omp atomic capture {++a;c = a;} #pragma omp atomic capture {c = a;a--;} @@ -321,6 +323,8 @@ int captureint() { #pragma omp atomic capture {c = a; a += b;} #pragma omp atomic capture + {c = a; (a) += b;} +#pragma omp atomic capture {a %= b; c = a;} #pragma omp atomic capture {c = a; a *= b;} Modified: cfe/trunk/test/OpenMP/atomic_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/atomic_messages.cpp?rev=276167&r1=276166&r2=276167&view=diff == --- cfe/trunk/test/OpenMP/atomic_messages.cpp (original) +++ cfe/trunk/test/OpenMP/atomic_messages.cpp Wed Jul 20 14:41:17 2016 @@ -453,6 +453,8 @@ T capture() { #pragma omp atomic capture {c = a; a++;} #pragma omp atomic capture + {c = a; (a)++;} +#pragma omp atomic capture {++a;c = a;} #pragma omp atomic capture {c = a;a--;} @@ -461,6 +463,8 @@ T capture() { #pragma omp atomic capture {c = a; a += b;} #pragma omp atomic capture + {c = a; (a) += b;} +#pragma omp atomic capture {a %= b; c = a;} #pragma omp atomic capture {c = a; a *= b;} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r276177 - [OpenMP] Allow negative lower bound in array sections based on pointers
Author: kli Date: Wed Jul 20 15:45:29 2016 New Revision: 276177 URL: http://llvm.org/viewvc/llvm-project?rev=276177&view=rev Log: [OpenMP] Allow negative lower bound in array sections based on pointers OpenMP 4.5 removed the restriction that array section lower bound must be non negative. This change is to allow negative values for array section based on pointers. For array section based on array type there is still a restriction: "The array section must be a subset of the original array." Patch by David S. Differential Revision: https://reviews.llvm.org/D22481 Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/Sema/SemaExpr.cpp cfe/trunk/test/OpenMP/target_depend_messages.cpp cfe/trunk/test/OpenMP/target_enter_data_depend_messages.cpp cfe/trunk/test/OpenMP/target_exit_data_depend_messages.cpp cfe/trunk/test/OpenMP/target_map_messages.cpp cfe/trunk/test/OpenMP/target_parallel_depend_messages.cpp cfe/trunk/test/OpenMP/target_parallel_for_depend_messages.cpp cfe/trunk/test/OpenMP/target_parallel_for_map_messages.cpp cfe/trunk/test/OpenMP/target_parallel_for_simd_depend_messages.cpp cfe/trunk/test/OpenMP/target_parallel_for_simd_map_messages.cpp cfe/trunk/test/OpenMP/target_parallel_map_messages.cpp cfe/trunk/test/OpenMP/target_update_depend_messages.cpp cfe/trunk/test/OpenMP/task_depend_messages.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=276177&r1=276176&r2=276177&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed Jul 20 15:45:29 2016 @@ -8260,8 +8260,10 @@ def warn_omp_section_is_char : Warning<" InGroup, DefaultIgnore; def err_omp_section_incomplete_type : Error< "section of pointer to incomplete type %0">; -def err_omp_section_negative : Error< - "section %select{lower bound|length}0 is evaluated to a negative value %1">; +def err_omp_section_not_subset_of_array : Error< + "array section must be a subset of the original array">; +def err_omp_section_length_negative : Error< + "section length is evaluated to a negative value %0">; def err_omp_section_length_undefined : Error< "section length is unspecified and cannot be inferred because subscripted value is %select{not an array|an array of unknown bound}0">; def err_omp_wrong_linear_modifier : Error< Modified: cfe/trunk/lib/Sema/SemaExpr.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=276177&r1=276176&r2=276177&view=diff == --- cfe/trunk/lib/Sema/SemaExpr.cpp (original) +++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Jul 20 15:45:29 2016 @@ -4304,14 +4304,13 @@ ExprResult Sema::ActOnOMPArraySectionExp diag::err_omp_section_incomplete_type, Base)) return ExprError(); - if (LowerBound) { + if (LowerBound && !OriginalTy->isAnyPointerType()) { llvm::APSInt LowerBoundValue; if (LowerBound->EvaluateAsInt(LowerBoundValue, Context)) { - // OpenMP 4.0, [2.4 Array Sections] - // The lower-bound and length must evaluate to non-negative integers. + // OpenMP 4.5, [2.4 Array Sections] + // The array section must be a subset of the original array. if (LowerBoundValue.isNegative()) { -Diag(LowerBound->getExprLoc(), diag::err_omp_section_negative) -<< 0 << LowerBoundValue.toString(/*Radix=*/10, /*Signed=*/true) +Diag(LowerBound->getExprLoc(), diag::err_omp_section_not_subset_of_array) << LowerBound->getSourceRange(); return ExprError(); } @@ -4321,11 +4320,11 @@ ExprResult Sema::ActOnOMPArraySectionExp if (Length) { llvm::APSInt LengthValue; if (Length->EvaluateAsInt(LengthValue, Context)) { - // OpenMP 4.0, [2.4 Array Sections] - // The lower-bound and length must evaluate to non-negative integers. + // OpenMP 4.5, [2.4 Array Sections] + // The length must evaluate to non-negative integers. if (LengthValue.isNegative()) { -Diag(Length->getExprLoc(), diag::err_omp_section_negative) -<< 1 << LengthValue.toString(/*Radix=*/10, /*Signed=*/true) +Diag(Length->getExprLoc(), diag::err_omp_section_length_negative) +<< LengthValue.toString(/*Radix=*/10, /*Signed=*/true) << Length->getSourceRange(); return ExprError(); } @@ -4333,7 +4332,7 @@ ExprResult Sema::ActOnOMPArraySectionExp } else if (ColonLoc.isValid() && (OriginalTy.isNull() || (!OriginalTy->isConstantArrayType() && !OriginalTy->isVariableArrayType( { -// OpenMP 4.0, [2.4 Array Sections] +// OpenMP 4.5, [2.4 Array Sections]
[PATCH] D22785: [OpenMP] diagnose orphaned teams construct
kkwli0 created this revision. kkwli0 added reviewers: ABataev, sfantao, carlo.bertolli, arpith-jacob, hfinkel. kkwli0 added a subscriber: cfe-commits. The spec mandates that 'a teams construct must be contained within a target construct'. Currently, this scenario is not diagnosed. This patch is to add check for orphaned teams construct and issue an error message. https://reviews.llvm.org/D22785 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaOpenMP.cpp test/OpenMP/nesting_of_regions.cpp Index: test/OpenMP/nesting_of_regions.cpp === --- test/OpenMP/nesting_of_regions.cpp +++ test/OpenMP/nesting_of_regions.cpp @@ -3693,6 +3693,8 @@ } // TEAMS DIRECTIVE +#pragma omp teams // expected-error {{orphaned 'omp teams' directives are prohibited; perhaps you forget to enclose the directive into a target region?}} + bar(); #pragma omp target #pragma omp teams #pragma omp parallel Index: lib/Sema/SemaOpenMP.cpp === --- lib/Sema/SemaOpenMP.cpp +++ lib/Sema/SemaOpenMP.cpp @@ -3172,6 +3172,7 @@ auto OffendingRegion = ParentRegion; bool NestingProhibited = false; bool CloseNesting = true; +bool OrphanSeen = false; enum { NoRecommend, ShouldBeInParallelRegion, @@ -3213,9 +3214,10 @@ } return false; } -// Allow some constructs to be orphaned (they could be used in functions, -// called from OpenMP regions with the required preconditions). -if (ParentRegion == OMPD_unknown) +// Allow some constructs (except teams) to be orphaned (they could be +// used in functions, called from OpenMP regions with the required +// preconditions). +if (ParentRegion == OMPD_unknown && !isOpenMPTeamsDirective(CurrentRegion)) return false; if (CurrentRegion == OMPD_cancellation_point || CurrentRegion == OMPD_cancel) { @@ -3315,6 +3317,7 @@ // If specified, a teams construct must be contained within a target // construct. NestingProhibited = ParentRegion != OMPD_target; + OrphanSeen = ParentRegion == OMPD_unknown; Recommend = ShouldBeInTargetRegion; Stack->setParentTeamsRegionLoc(Stack->getConstructLoc()); } @@ -3354,9 +3357,13 @@ CloseNesting = false; } if (NestingProhibited) { - SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region) - << CloseNesting << getOpenMPDirectiveName(OffendingRegion) - << Recommend << getOpenMPDirectiveName(CurrentRegion); + if (OrphanSeen) +SemaRef.Diag(StartLoc, diag::err_omp_orphaned_device_directive) +<< getOpenMPDirectiveName(CurrentRegion) << Recommend; + else +SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region) +<< CloseNesting << getOpenMPDirectiveName(OffendingRegion) +<< Recommend << getOpenMPDirectiveName(CurrentRegion); return true; } } Index: include/clang/Basic/DiagnosticSemaKinds.td === --- include/clang/Basic/DiagnosticSemaKinds.td +++ include/clang/Basic/DiagnosticSemaKinds.td @@ -8389,6 +8389,9 @@ def warn_omp_nesting_simd : Warning< "OpenMP only allows an ordered construct with the simd clause nested in a simd construct">, InGroup; +def err_omp_orphaned_device_directive : Error< + "orphaned 'omp %0' directives are prohibited" + "; perhaps you forget to enclose the directive into a %select{|||target |teams }1region?">; } // end of OpenMP category let CategoryName = "Related Result Type Issue" in { Index: test/OpenMP/nesting_of_regions.cpp === --- test/OpenMP/nesting_of_regions.cpp +++ test/OpenMP/nesting_of_regions.cpp @@ -3693,6 +3693,8 @@ } // TEAMS DIRECTIVE +#pragma omp teams // expected-error {{orphaned 'omp teams' directives are prohibited; perhaps you forget to enclose the directive into a target region?}} + bar(); #pragma omp target #pragma omp teams #pragma omp parallel Index: lib/Sema/SemaOpenMP.cpp === --- lib/Sema/SemaOpenMP.cpp +++ lib/Sema/SemaOpenMP.cpp @@ -3172,6 +3172,7 @@ auto OffendingRegion = ParentRegion; bool NestingProhibited = false; bool CloseNesting = true; +bool OrphanSeen = false; enum { NoRecommend, ShouldBeInParallelRegion, @@ -3213,9 +3214,10 @@ } return false; } -// Allow some constructs to be orphaned (they could be used in functions, -// called from OpenMP regions with the required preconditions). -if (ParentRegion == OMPD_unknown) +// Allow some constructs (except teams) to be orphaned (they could be +// used in functions, called from OpenMP regions with the required +// preconditions). +if (ParentRegion == OMPD_unknown && !i
Re: [PATCH] D22785: [OpenMP] diagnose orphaned teams construct
kkwli0 added a comment. Will add the braces. Thanks. https://reviews.llvm.org/D22785 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r276726 - [OpenMP] diagnose orphaned teams construct
Author: kli Date: Mon Jul 25 23:32:50 2016 New Revision: 276726 URL: http://llvm.org/viewvc/llvm-project?rev=276726&view=rev Log: [OpenMP] diagnose orphaned teams construct The OpenMP spec mandates that 'a teams construct must be contained within a target construct'. Currently, this scenario is not diagnosed. This patch is to add check for orphaned teams construct and issue an error message. Differential Revision: https://reviews.llvm.org/D22785 Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/test/OpenMP/nesting_of_regions.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=276726&r1=276725&r2=276726&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Jul 25 23:32:50 2016 @@ -8389,6 +8389,9 @@ def err_omp_argument_type_isdeviceptr : def warn_omp_nesting_simd : Warning< "OpenMP only allows an ordered construct with the simd clause nested in a simd construct">, InGroup; +def err_omp_orphaned_device_directive : Error< + "orphaned 'omp %0' directives are prohibited" + "; perhaps you forget to enclose the directive into a %select{|||target |teams }1region?">; } // end of OpenMP category let CategoryName = "Related Result Type Issue" in { Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=276726&r1=276725&r2=276726&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Mon Jul 25 23:32:50 2016 @@ -3172,6 +3172,7 @@ static bool CheckNestingOfRegions(Sema & auto OffendingRegion = ParentRegion; bool NestingProhibited = false; bool CloseNesting = true; +bool OrphanSeen = false; enum { NoRecommend, ShouldBeInParallelRegion, @@ -3213,9 +3214,10 @@ static bool CheckNestingOfRegions(Sema & } return false; } -// Allow some constructs to be orphaned (they could be used in functions, -// called from OpenMP regions with the required preconditions). -if (ParentRegion == OMPD_unknown) +// Allow some constructs (except teams) to be orphaned (they could be +// used in functions, called from OpenMP regions with the required +// preconditions). +if (ParentRegion == OMPD_unknown && !isOpenMPTeamsDirective(CurrentRegion)) return false; if (CurrentRegion == OMPD_cancellation_point || CurrentRegion == OMPD_cancel) { @@ -3315,6 +3317,7 @@ static bool CheckNestingOfRegions(Sema & // If specified, a teams construct must be contained within a target // construct. NestingProhibited = ParentRegion != OMPD_target; + OrphanSeen = ParentRegion == OMPD_unknown; Recommend = ShouldBeInTargetRegion; Stack->setParentTeamsRegionLoc(Stack->getConstructLoc()); } @@ -3354,9 +3357,14 @@ static bool CheckNestingOfRegions(Sema & CloseNesting = false; } if (NestingProhibited) { - SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region) - << CloseNesting << getOpenMPDirectiveName(OffendingRegion) - << Recommend << getOpenMPDirectiveName(CurrentRegion); + if (OrphanSeen) { +SemaRef.Diag(StartLoc, diag::err_omp_orphaned_device_directive) +<< getOpenMPDirectiveName(CurrentRegion) << Recommend; + } else { +SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region) +<< CloseNesting << getOpenMPDirectiveName(OffendingRegion) +<< Recommend << getOpenMPDirectiveName(CurrentRegion); + } return true; } } Modified: cfe/trunk/test/OpenMP/nesting_of_regions.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/nesting_of_regions.cpp?rev=276726&r1=276725&r2=276726&view=diff == --- cfe/trunk/test/OpenMP/nesting_of_regions.cpp (original) +++ cfe/trunk/test/OpenMP/nesting_of_regions.cpp Mon Jul 25 23:32:50 2016 @@ -3693,6 +3693,8 @@ void foo() { } // TEAMS DIRECTIVE +#pragma omp teams // expected-error {{orphaned 'omp teams' directives are prohibited; perhaps you forget to enclose the directive into a target region?}} + bar(); #pragma omp target #pragma omp teams #pragma omp parallel ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23189: [OpenMP] Sema and parsing for 'teams distribute' pragma
kkwli0 added a comment. Thanks. I will update it when I commit the patch. https://reviews.llvm.org/D23189 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r273190 - [OpenMP] Add the nowait clause to target update construct.
Author: kli Date: Mon Jun 20 14:16:34 2016 New Revision: 273190 URL: http://llvm.org/viewvc/llvm-project?rev=273190&view=rev Log: [OpenMP] Add the nowait clause to target update construct. Differential Revision: http://reviews.llvm.org/D21477 Added: cfe/trunk/test/OpenMP/target_update_nowait_messages.cpp Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def cfe/trunk/test/OpenMP/target_update_ast_print.cpp Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=273190&r1=273189&r2=273190&view=diff == --- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original) +++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Mon Jun 20 14:16:34 2016 @@ -454,6 +454,7 @@ OPENMP_TARGET_UPDATE_CLAUSE(if) OPENMP_TARGET_UPDATE_CLAUSE(device) OPENMP_TARGET_UPDATE_CLAUSE(to) OPENMP_TARGET_UPDATE_CLAUSE(from) +OPENMP_TARGET_UPDATE_CLAUSE(nowait) // Clauses allowed for OpenMP directive 'teams'. // TODO More clauses for 'teams' directive. Modified: cfe/trunk/test/OpenMP/target_update_ast_print.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_update_ast_print.cpp?rev=273190&r1=273189&r2=273190&view=diff == --- cfe/trunk/test/OpenMP/target_update_ast_print.cpp (original) +++ cfe/trunk/test/OpenMP/target_update_ast_print.cpp Mon Jun 20 14:16:34 2016 @@ -13,26 +13,26 @@ T foo(T targ, U uarg) { static T a; U b; int l; -#pragma omp target update to(a) if(l>5) device(l) +#pragma omp target update to(a) if(l>5) device(l) nowait -#pragma omp target update from(b) if(l<5) device(l-1) +#pragma omp target update from(b) if(l<5) device(l-1) nowait return a + targ + (T)b; } // CHECK: static int a; // CHECK-NEXT: float b; // CHECK-NEXT: int l; // CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) -// CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) +// CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) nowait // CHECK: static char a; // CHECK-NEXT: float b; // CHECK-NEXT: int l; -// CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) -// CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) +// CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) nowait +// CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) nowait // CHECK: static T a; // CHECK-NEXT: U b; // CHECK-NEXT: int l; -// CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) -// CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) +// CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) nowait +// CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) nowait int main(int argc, char **argv) { static int a; @@ -42,10 +42,10 @@ int main(int argc, char **argv) { // CHECK: static int a; // CHECK-NEXT: int n; // CHECK-NEXT: float f; -#pragma omp target update to(a) if(f>0.0) device(n) - // CHECK-NEXT: #pragma omp target update to(a) if(f > 0.) device(n) -#pragma omp target update from(f) if(f<0.0) device(n+1) - // CHECK-NEXT: #pragma omp target update from(f) if(f < 0.) device(n + 1) +#pragma omp target update to(a) if(f>0.0) device(n) nowait +// CHECK-NEXT: #pragma omp target update to(a) if(f > 0.) device(n) nowait +#pragma omp target update from(f) if(f<0.0) device(n+1) nowait +// CHECK-NEXT: #pragma omp target update from(f) if(f < 0.) device(n + 1) nowait return foo(argc, f) + foo(argv[0][0], f) + a; } Added: cfe/trunk/test/OpenMP/target_update_nowait_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_update_nowait_messages.cpp?rev=273190&view=auto == --- cfe/trunk/test/OpenMP/target_update_nowait_messages.cpp (added) +++ cfe/trunk/test/OpenMP/target_update_nowait_messages.cpp Mon Jun 20 14:16:34 2016 @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s + +int main(int argc, char **argv) { + int i; + + #pragma omp nowait target update to(i) // expected-error {{expected an OpenMP directive}} + #pragma omp target nowait update to(i) // expected-error {{unexpected OpenMP clause 'update' in directive '#pragma omp target'}} expected-error {{unexpected OpenMP clause 'to' in directive '#pragma omp target'}} + {} + #pragma omp target update nowait() to(i) // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} + #pragma omp target update to(i) nowait( // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} + #pragma omp target update to(i) nowait (argc)) // expec
r273369 - [OpenMP] Add the depend clause to target update construct (sema and parsing)
Author: kli Date: Tue Jun 21 22:10:32 2016 New Revision: 273369 URL: http://llvm.org/viewvc/llvm-project?rev=273369&view=rev Log: [OpenMP] Add the depend clause to target update construct (sema and parsing) Differential Revision: http://reviews.llvm.org/D21532 Added: cfe/trunk/test/OpenMP/target_update_depend_messages.cpp Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def cfe/trunk/test/OpenMP/target_update_ast_print.cpp Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=273369&r1=273368&r2=273369&view=diff == --- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original) +++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Tue Jun 21 22:10:32 2016 @@ -455,6 +455,7 @@ OPENMP_TARGET_UPDATE_CLAUSE(device) OPENMP_TARGET_UPDATE_CLAUSE(to) OPENMP_TARGET_UPDATE_CLAUSE(from) OPENMP_TARGET_UPDATE_CLAUSE(nowait) +OPENMP_TARGET_UPDATE_CLAUSE(depend) // Clauses allowed for OpenMP directive 'teams'. // TODO More clauses for 'teams' directive. Modified: cfe/trunk/test/OpenMP/target_update_ast_print.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_update_ast_print.cpp?rev=273369&r1=273368&r2=273369&view=diff == --- cfe/trunk/test/OpenMP/target_update_ast_print.cpp (original) +++ cfe/trunk/test/OpenMP/target_update_ast_print.cpp Tue Jun 21 22:10:32 2016 @@ -13,26 +13,26 @@ T foo(T targ, U uarg) { static T a; U b; int l; -#pragma omp target update to(a) if(l>5) device(l) nowait +#pragma omp target update to(a) if(l>5) device(l) nowait depend(inout:l) -#pragma omp target update from(b) if(l<5) device(l-1) nowait +#pragma omp target update from(b) if(l<5) device(l-1) nowait depend(inout:l) return a + targ + (T)b; } // CHECK: static int a; // CHECK-NEXT: float b; // CHECK-NEXT: int l; -// CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) -// CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) nowait +// CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) nowait depend(inout : l) +// CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) nowait depend(inout : l) // CHECK: static char a; // CHECK-NEXT: float b; // CHECK-NEXT: int l; -// CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) nowait -// CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) nowait +// CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) nowait depend(inout : l) +// CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) nowait depend(inout : l) // CHECK: static T a; // CHECK-NEXT: U b; // CHECK-NEXT: int l; -// CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) nowait -// CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) nowait +// CHECK-NEXT: #pragma omp target update to(a) if(l > 5) device(l) nowait depend(inout : l) +// CHECK-NEXT: #pragma omp target update from(b) if(l < 5) device(l - 1) nowait depend(inout : l) int main(int argc, char **argv) { static int a; @@ -42,10 +42,10 @@ int main(int argc, char **argv) { // CHECK: static int a; // CHECK-NEXT: int n; // CHECK-NEXT: float f; -#pragma omp target update to(a) if(f>0.0) device(n) nowait -// CHECK-NEXT: #pragma omp target update to(a) if(f > 0.) device(n) nowait -#pragma omp target update from(f) if(f<0.0) device(n+1) nowait -// CHECK-NEXT: #pragma omp target update from(f) if(f < 0.) device(n + 1) nowait +#pragma omp target update to(a) if(f>0.0) device(n) nowait depend(in:n) +// CHECK-NEXT: #pragma omp target update to(a) if(f > 0.) device(n) nowait depend(in : n) +#pragma omp target update from(f) if(f<0.0) device(n+1) nowait depend(in:n) +// CHECK-NEXT: #pragma omp target update from(f) if(f < 0.) device(n + 1) nowait depend(in : n) return foo(argc, f) + foo(argv[0][0], f) + a; } Added: cfe/trunk/test/OpenMP/target_update_depend_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_update_depend_messages.cpp?rev=273369&view=auto == --- cfe/trunk/test/OpenMP/target_update_depend_messages.cpp (added) +++ cfe/trunk/test/OpenMP/target_update_depend_messages.cpp Tue Jun 21 22:10:32 2016 @@ -0,0 +1,112 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - -std=c++11 %s + +void foo() { +} + +bool foobool(int argc) { + return argc; +} + +struct S1; // expected-note 2 {{declared here}} + +class vector { + public: +int operator[](int index) { return 0; } +}; + +template +int tmain(T argc, S **argv, R *env[]) { + vector vec; + typedef float V __attribute__((vector_size(16))); + V a; + char *arr; + int i, z; + + #pragma omp depend target update to(z) // expected-error{{e
Re: [PATCH] D21617: [OpenMP] Diagnose missing cases of statements between target and teams directives
kkwli0 added a comment. The changes look fine to me. Thanks. http://reviews.llvm.org/D21617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r273908 - [OpenMP] Diagnose missing cases of statements between target and teams directives
Author: kli Date: Mon Jun 27 14:15:43 2016 New Revision: 273908 URL: http://llvm.org/viewvc/llvm-project?rev=273908&view=rev Log: [OpenMP] Diagnose missing cases of statements between target and teams directives Clang fails to diagnose cases such as #pragma omp target while(0) { #pragma omp teams {} } A patch by David Sheinkman. Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/test/OpenMP/nesting_of_regions.cpp Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=273908&r1=273907&r2=273908&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Mon Jun 27 14:15:43 2016 @@ -6537,6 +6537,9 @@ StmtResult Sema::ActOnOpenMPTargetDirect } assert(I != CS->body_end() && "Not found statement"); S = *I; +} else { + auto *OED = dyn_cast(S); + OMPTeamsFound = OED && isOpenMPTeamsDirective(OED->getDirectiveKind()); } if (!OMPTeamsFound) { Diag(StartLoc, diag::err_omp_target_contains_not_only_teams); Modified: cfe/trunk/test/OpenMP/nesting_of_regions.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/nesting_of_regions.cpp?rev=273908&r1=273907&r2=273908&view=diff == --- cfe/trunk/test/OpenMP/nesting_of_regions.cpp (original) +++ cfe/trunk/test/OpenMP/nesting_of_regions.cpp Mon Jun 27 14:15:43 2016 @@ -2960,6 +2960,12 @@ void foo() { #pragma omp teams // expected-note {{nested teams construct here}} ++a; } +#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} + { +while (0) // expected-note {{statement outside teams construct here}} +#pragma omp teams // expected-note {{nested teams construct here}} +++a; + } #pragma omp target { #pragma omp taskloop ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D21617: [OpenMP] Diagnose missing cases of statements between target and teams directives
kkwli0 closed this revision. kkwli0 added a comment. At revision: 273908 http://reviews.llvm.org/D21617 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D21904: [OpenMP] Initial implementation of parse+sema for clause use_device_ptr of 'target data'
kkwli0 added inline comments. Comment at: lib/Sema/SemaOpenMP.cpp:11377 @@ +11376,3 @@ +// item should be a pointer or array +if (!Type.getNonReferenceType()->isPointerType()) { + Diag(ELoc, diag::err_omp_usedeviceptr_not_a_pointer) sfantao wrote: > ABataev wrote: > > sfantao wrote: > > > ABataev wrote: > > > > You should not skip the reference from the type, references are not > > > > allowed also > > > Hi Alexey, I think the item can be a reference to a pointer. I couldn't > > > find that restriction in the spec, can you point me to what you are > > > referring to? We should probably refer to that in the preceding comment. > > > > > > Thanks! > > Here is the restriction: > > "2.10.1 target data Construct, restrictions. References in the construct to > > a list item that appears in a use_device_ptr clause must be to the address > > of the list item." > > Does it mean that references are allowed? > Ok, thanks. My interpretation is that that restriction refers to references > used in clauses (in the same construct) other than use_device_ptr to > declarations used in use_device_ptr. I think the motivation is to restrict > the use of the value of the pointer by other clauses given that value is > going to change for that data environment because of the behavior implemented > by use_device_ptr. Carlo, what is your interpretation? I interpret the rule to the list item being used inside the construct instead of being used in the other clauses on the same construct. Repository: rL LLVM http://reviews.llvm.org/D21904 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r274352 - [OpenMP] Issue warning if a simd construct nested inside another simd
Author: kli Date: Fri Jul 1 09:30:25 2016 New Revision: 274352 URL: http://llvm.org/viewvc/llvm-project?rev=274352&view=rev Log: [OpenMP] Issue warning if a simd construct nested inside another simd construct Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/test/OpenMP/nesting_of_regions.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=274352&r1=274351&r2=274352&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Jul 1 09:30:25 2016 @@ -8318,6 +8318,9 @@ def err_omp_expected_int_param : Error< "expected a reference to an integer-typed parameter">; def err_omp_at_least_one_motion_clause_required : Error< "expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'">; +def warn_omp_nesting_simd : Warning< + "OpenMP only allows an ordered construct with the simd clause nested in a simd construct">, + InGroup; } // end of OpenMP category let CategoryName = "Related Result Type Issue" in { Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=274352&r1=274351&r2=274352&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Fri Jul 1 09:30:25 2016 @@ -2940,15 +2940,19 @@ static bool CheckNestingOfRegions(Sema & ShouldBeInTargetRegion, ShouldBeInTeamsRegion } Recommend = NoRecommend; -if (isOpenMPSimdDirective(ParentRegion) && CurrentRegion != OMPD_ordered && -CurrentRegion != OMPD_simd) { +if (isOpenMPSimdDirective(ParentRegion) && CurrentRegion != OMPD_ordered) { // OpenMP [2.16, Nesting of Regions] // OpenMP constructs may not be nested inside a simd region. // OpenMP [2.8.1,simd Construct, Restrictions] - // An ordered construct with the simd clause is the only OpenMP construct - // that can appear in the simd region. - SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region_simd); - return true; + // An ordered construct with the simd clause is the only OpenMP + // construct that can appear in the simd region. + // Allowing a SIMD consruct nested in another SIMD construct is an + // extension. The OpenMP 4.5 spec does not allow it. Issue a warning + // message. + SemaRef.Diag(StartLoc, (CurrentRegion != OMPD_simd) + ? diag::err_omp_prohibited_region_simd + : diag::warn_omp_nesting_simd); + return CurrentRegion != OMPD_simd; } if (ParentRegion == OMPD_atomic) { // OpenMP [2.16, Nesting of Regions] Modified: cfe/trunk/test/OpenMP/nesting_of_regions.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/nesting_of_regions.cpp?rev=274352&r1=274351&r2=274352&view=diff == --- cfe/trunk/test/OpenMP/nesting_of_regions.cpp (original) +++ cfe/trunk/test/OpenMP/nesting_of_regions.cpp Fri Jul 1 09:30:25 2016 @@ -153,7 +153,7 @@ void foo() { } #pragma omp simd for (int i = 0; i < 10; ++i) { -#pragma omp simd +#pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}} for (int i = 0; i < 10; ++i) ; } @@ -257,6 +257,16 @@ void foo() { } #pragma omp simd for (int i = 0; i < 10; ++i) { +#pragma omp ordered simd // OK +bar(); + } +#pragma omp simd + for (int i = 0; i < 10; ++i) { +#pragma omp ordered threads // expected-error {{OpenMP constructs may not be nested inside a simd region}} +bar(); + } +#pragma omp simd + for (int i = 0; i < 10; ++i) { #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}} ++a; } @@ -516,7 +526,7 @@ void foo() { } #pragma omp for simd for (int i = 0; i < 10; ++i) { -#pragma omp simd +#pragma omp simd // expected-warning {{OpenMP only allows an ordered construct with the simd clause nested in a simd construct}} for (int i = 0; i < 10; ++i) ; } @@ -620,6 +630,16 @@ void foo() { } #pragma omp for simd for (int i = 0; i < 10; ++i) { +#pragma omp ordered simd // OK +bar(); + } +#pragma omp for simd + for (int i = 0; i < 10; ++i) { +#pragma omp ordered threads // expected-error {{OpenMP constructs may not be nested inside a simd region}} +bar(); + } +#pragma omp for simd + for (int i = 0; i < 10; ++i) { #pragma omp atomic // expected-error {{OpenMP constructs may not be nested inside a simd region}} ++a; } @@ -1902,7 +1922,7
r274577 - [OpenMP] remove outdated comment (NFC)
Author: kli Date: Tue Jul 5 16:38:53 2016 New Revision: 274577 URL: http://llvm.org/viewvc/llvm-project?rev=274577&view=rev Log: [OpenMP] remove outdated comment (NFC) Modified: cfe/trunk/lib/Basic/OpenMPKinds.cpp Modified: cfe/trunk/lib/Basic/OpenMPKinds.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/OpenMPKinds.cpp?rev=274577&r1=274576&r2=274577&view=diff == --- cfe/trunk/lib/Basic/OpenMPKinds.cpp (original) +++ cfe/trunk/lib/Basic/OpenMPKinds.cpp Tue Jul 5 16:38:53 2016 @@ -644,7 +644,6 @@ bool clang::isOpenMPTargetExecutionDirec } bool clang::isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind) { - // TODO add target update directive check. return DKind == OMPD_target_data || DKind == OMPD_target_enter_data || DKind == OMPD_target_exit_data || DKind == OMPD_target_update; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D22169: [OpenMP] add more tests for 'distribute parallel for simd' pragma
kkwli0 created this revision. kkwli0 added reviewers: ABataev, sfantao, carlo.bertolli, arpith-jacob, hfinkel. kkwli0 added a subscriber: cfe-commits. This patch is to add two additional tests for testing 'distribute parallel for simd' pragma with disallowed clauses and loops. http://reviews.llvm.org/D22169 Files: test/OpenMP/distribute_parallel_for_simd_loop_messages.cpp test/OpenMP/distribute_parallel_for_simd_misc_messages.c Index: test/OpenMP/distribute_parallel_for_simd_misc_messages.c === --- /dev/null +++ test/OpenMP/distribute_parallel_for_simd_misc_messages.c @@ -0,0 +1,954 @@ +// RUN: %clang_cc1 -fsyntax-only -fopenmp -verify %s + +// expected-error@+1 {{unexpected OpenMP directive '#pragma omp distribute parallel for simd'}} +#pragma omp distribute parallel for simd + +// expected-error@+1 {{unexpected OpenMP directive '#pragma omp distribute parallel for simd'}} +#pragma omp distribute parallel for simd foo + +void test_no_clause() { + int i; +#pragma omp distribute parallel for simd + for (i = 0; i < 16; ++i) +; + +// expected-error@+2 {{statement after '#pragma omp distribute parallel for simd' must be a for loop}} +#pragma omp distribute parallel for simd + ++i; +} + +void test_branch_protected_scope() { + int i = 0; +L1: + ++i; + + int x[24]; + +#pragma omp target +#pragma omp teams +#pragma omp distribute parallel for simd + for (i = 0; i < 16; ++i) { +if (i == 5) + goto L1; // expected-error {{use of undeclared label 'L1'}} +else if (i == 6) + return; // expected-error {{cannot return from OpenMP region}} +else if (i == 7) + goto L2; +else if (i == 8) { +L2: + x[i]++; +} + } + + if (x[0] == 0) +goto L2; // expected-error {{use of undeclared label 'L2'}} + else if (x[1] == 1) +goto L1; +} + +void test_invalid_clause() { + int i; +#pragma omp target +#pragma omp teams +// expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}} +#pragma omp distribute parallel for simd foo bar + for (i = 0; i < 16; ++i) +; +} + +void test_non_identifiers() { + int i, x; + +#pragma omp target +#pragma omp teams +// expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}} +#pragma omp distribute parallel for simd; + for (i = 0; i < 16; ++i) +; +#pragma omp target +#pragma omp teams +// expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}} +#pragma omp distribute parallel for simd linear(x); + for (i = 0; i < 16; ++i) +; + +#pragma omp target +#pragma omp teams +// expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}} +#pragma omp distribute parallel for simd private(x); + for (i = 0; i < 16; ++i) +; + +#pragma omp target +#pragma omp teams +// expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}} +#pragma omp distribute parallel for simd, private(x); + for (i = 0; i < 16; ++i) +; +} + +extern int foo(); +void test_safelen() { + int i; +#pragma omp target +#pragma omp teams +// expected-error@+1 {{expected '('}} +#pragma omp distribute parallel for simd safelen + for (i = 0; i < 16; ++i) +; +#pragma omp target +#pragma omp teams +// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} +#pragma omp distribute parallel for simd safelen( + for (i = 0; i < 16; ++i) +; +#pragma omp target +#pragma omp teams +// expected-error@+1 {{expected expression}} +#pragma omp distribute parallel for simd safelen() + for (i = 0; i < 16; ++i) +; +#pragma omp target +#pragma omp teams +// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} +#pragma omp distribute parallel for simd safelen(, + for (i = 0; i < 16; ++i) +; +#pragma omp target +#pragma omp teams +// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} +#pragma omp distribute parallel for simd safelen(, ) + for (i = 0; i < 16; ++i) +; +#pragma omp target +#pragma omp teams +// expected-warning@+2 {{extra tokens at the end of '#pragma omp distribute parallel for simd' are ignored}} +// expected-error@+1 {{expected '('}} +#pragma omp distribute parallel for simd safelen 4) + for (i = 0; i < 16; ++i) +; +#pragma omp target +#pragma omp teams +// expected-error@+2 {{expected ')'}} +// expected-note@+1 {{to match this '('}} +#pragma omp distribute parallel for simd safelen(4 + for (i = 0; i < 16; ++i) +; +#pragma omp target +#pragma omp teams +// expected-error@+2 {{expected ')'}} +// expected-note@+1 {{to match this '('}} +#pragma omp distribute parallel for simd safelen(4, + for (i = 0; i < 16; ++i) +; +#pragma omp target +#pragma
[PATCH] D22176: [OpenMP] add more tests for 'distribute simd' pragma
kkwli0 created this revision. kkwli0 added reviewers: ABataev, sfantao, carlo.bertolli, hfinkel, arpith-jacob. kkwli0 added a subscriber: cfe-commits. This patch is to add two additional tests for testing 'distribute simd' pragma with disallowed clauses and loops. http://reviews.llvm.org/D22176 Files: test/OpenMP/distribute_simd_loop_messages.cpp test/OpenMP/distribute_simd_misc_messages.c Index: test/OpenMP/distribute_simd_misc_messages.c === --- /dev/null +++ test/OpenMP/distribute_simd_misc_messages.c @@ -0,0 +1,1091 @@ +// RUN: %clang_cc1 -fsyntax-only -fopenmp -verify %s + +// expected-error@+1 {{unexpected OpenMP directive '#pragma omp distribute simd'}} +#pragma omp distribute simd + +// expected-error@+1 {{unexpected OpenMP directive '#pragma omp distribute simd'}} +#pragma omp distribute simd foo + +// expected-error@+1 {{unexpected OpenMP directive '#pragma omp distribute simd'}} +#pragma omp distribute simd safelen(4) + +void test_no_clause() { + int i; +#pragma omp target +#pragma omp teams +#pragma omp distribute simd + for (i = 0; i < 16; ++i) +; + +#pragma omp target +#pragma omp teams +// expected-error@+2 {{statement after '#pragma omp distribute simd' must be a for loop}} +#pragma omp distribute simd + ++i; +} + +void test_branch_protected_scope() { + int i = 0; +L1: + ++i; + + int x[24]; + +#pragma omp target +#pragma omp teams +#pragma omp distribute simd + for (i = 0; i < 16; ++i) { +if (i == 5) + goto L1; // expected-error {{use of undeclared label 'L1'}} +else if (i == 6) + return; // expected-error {{cannot return from OpenMP region}} +else if (i == 7) + goto L2; +else if (i == 8) { +L2: + x[i]++; +} + } + + if (x[0] == 0) +goto L2; // expected-error {{use of undeclared label 'L2'}} + else if (x[1] == 1) +goto L1; +} + +void test_invalid_clause() { + int i; +#pragma omp target +#pragma omp teams +// expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute simd' are ignored}} +#pragma omp distribute simd foo bar + for (i = 0; i < 16; ++i) +; +} + +void test_non_identifiers() { + int i, x; + +#pragma omp target +#pragma omp teams +// expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute simd' are ignored}} +#pragma omp distribute simd; + for (i = 0; i < 16; ++i) +; + +#pragma omp target +#pragma omp teams +// expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute simd' are ignored}} +#pragma omp distribute simd private(x); + for (i = 0; i < 16; ++i) +; + +#pragma omp target +#pragma omp teams +// expected-warning@+1 {{extra tokens at the end of '#pragma omp distribute simd' are ignored}} +#pragma omp distribute simd, private(x); + for (i = 0; i < 16; ++i) +; +} + +extern int foo(); +void test_safelen() { + int i; +#pragma omp target +#pragma omp teams +// expected-error@+1 {{expected '('}} +#pragma omp distribute simd safelen + for (i = 0; i < 16; ++i) +; +#pragma omp target +#pragma omp teams +// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} +#pragma omp distribute simd safelen( + for (i = 0; i < 16; ++i) +; +#pragma omp target +#pragma omp teams +// expected-error@+1 {{expected expression}} +#pragma omp distribute simd safelen() + for (i = 0; i < 16; ++i) +; +#pragma omp target +#pragma omp teams +// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} +#pragma omp distribute simd safelen(, + for (i = 0; i < 16; ++i) +; +#pragma omp target +#pragma omp teams +// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} +#pragma omp distribute simd safelen(, ) + for (i = 0; i < 16; ++i) +; +#pragma omp target +#pragma omp teams +// expected-warning@+2 {{extra tokens at the end of '#pragma omp distribute simd' are ignored}} +// expected-error@+1 {{expected '('}} +#pragma omp distribute simd safelen 4) + for (i = 0; i < 16; ++i) +; +#pragma omp target +#pragma omp teams +// expected-error@+2 {{expected ')'}} +// expected-note@+1 {{to match this '('}} +#pragma omp distribute simd safelen(4 + for (i = 0; i < 16; ++i) +; +#pragma omp target +#pragma omp teams +// expected-error@+2 {{expected ')'}} +// expected-note@+1 {{to match this '('}} +#pragma omp distribute simd safelen(4, + for (i = 0; i < 16; ++i) +; +#pragma omp target +#pragma omp teams +// expected-error@+2 {{expected ')'}} +// expected-note@+1 {{to match this '('}} +#pragma omp distribute simd safelen(4, ) + for (i = 0; i < 16; ++i) +; +#pragma omp target +#pragma omp teams +// xxpected-error@+1 {{expected expression}} +#pragma omp distribute simd safelen(4) + for (i = 0; i < 16; ++i) +; +#pragma omp target +#pragma omp teams +// expected-error@+2 {{expected ')'}} +// expected-n
r275306 - [OpenMP] add more tests for 'distribute simd' pragma
Author: kli Date: Wed Jul 13 14:16:56 2016 New Revision: 275306 URL: http://llvm.org/viewvc/llvm-project?rev=275306&view=rev Log: [OpenMP] add more tests for 'distribute simd' pragma This patch is to add two additional tests for testing 'distribute simd' pragma with disallowed clauses and loops. Differential Revision: http://reviews.llvm.org/D22176 Added: cfe/trunk/test/OpenMP/distribute_simd_loop_messages.cpp cfe/trunk/test/OpenMP/distribute_simd_misc_messages.c Added: cfe/trunk/test/OpenMP/distribute_simd_loop_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/distribute_simd_loop_messages.cpp?rev=275306&view=auto == --- cfe/trunk/test/OpenMP/distribute_simd_loop_messages.cpp (added) +++ cfe/trunk/test/OpenMP/distribute_simd_loop_messages.cpp Wed Jul 13 14:16:56 2016 @@ -0,0 +1,782 @@ +// RUN: %clang_cc1 -fsyntax-only -fopenmp -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify %s + +static int sii; +// expected-note@+1 {{defined as threadprivate or thread local}} +#pragma omp threadprivate(sii) +static int globalii; + +int test_iteration_spaces() { + const int N = 100; + float a[N], b[N], c[N]; + int ii, jj, kk; + float fii; + double dii; + #pragma omp target + #pragma omp teams + #pragma omp distribute simd + for (int i = 0; i < 10; i+=1) { +c[i] = a[i] + b[i]; + } + #pragma omp target + #pragma omp teams + #pragma omp distribute simd + for (char i = 0; i < 10; i++) { +c[i] = a[i] + b[i]; + } + #pragma omp target + #pragma omp teams + #pragma omp distribute simd + for (char i = 0; i < 10; i+='\1') { +c[i] = a[i] + b[i]; + } + #pragma omp target + #pragma omp teams + #pragma omp distribute simd + for (long long i = 0; i < 10; i++) { +c[i] = a[i] + b[i]; + } + #pragma omp target + #pragma omp teams + // expected-error@+2 {{expression must have integral or unscoped enumeration type, not 'double'}} + #pragma omp distribute simd + for (long long i = 0; i < 10; i+=1.5) { +c[i] = a[i] + b[i]; + } + #pragma omp target + #pragma omp teams + #pragma omp distribute simd + for (long long i = 0; i < 'z'; i+=1u) { +c[i] = a[i] + b[i]; + } + #pragma omp target + #pragma omp teams + // expected-error@+2 {{variable must be of integer or random access iterator type}} + #pragma omp distribute simd + for (float fi = 0; fi < 10.0; fi++) { +c[(int)fi] = a[(int)fi] + b[(int)fi]; + } + #pragma omp target + #pragma omp teams + // expected-error@+2 {{variable must be of integer or random access iterator type}} + #pragma omp distribute simd + for (double fi = 0; fi < 10.0; fi++) { +c[(int)fi] = a[(int)fi] + b[(int)fi]; + } + #pragma omp target + #pragma omp teams + // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}} + #pragma omp distribute simd + for (int &ref = ii; ref < 10; ref++) { + } + #pragma omp target + #pragma omp teams + // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}} + #pragma omp distribute simd + for (int i; i < 10; i++) +c[i] = a[i]; + + #pragma omp target + #pragma omp teams + // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}} + #pragma omp distribute simd + for (int i = 0, j = 0; i < 10; ++i) +c[i] = a[i]; + + #pragma omp target + #pragma omp teams + // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}} + #pragma omp distribute simd + for (;ii < 10; ++ii) +c[ii] = a[ii]; + + #pragma omp target + #pragma omp teams + // expected-warning@+3 {{expression result unused}} + // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}} + #pragma omp distribute simd + for (ii + 1;ii < 10; ++ii) +c[ii] = a[ii]; + + #pragma omp target + #pragma omp teams + // expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}} + #pragma omp distribute simd + for (c[ii] = 0;ii < 10; ++ii) +c[ii] = a[ii]; + + // Ok to skip parenthesises. + #pragma omp target + #pragma omp teams + #pragma omp distribute simd + for (((ii)) = 0;ii < 10; ++ii) +c[ii] = a[ii]; + + #pragma omp target + #pragma omp teams + // expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}} + #pragma omp distribute simd + for (int i = 0; i; i++) +c[i] = a[i]; + + #pragma omp target + #pragma omp teams + // expected-error@+3 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}} + // expected-error@+2 {{increment clause of OpenMP for loop must perform
r275315 - [OpenMP] add more tests for 'distribute parallel for simd' pragma
Author: kli Date: Wed Jul 13 15:40:32 2016 New Revision: 275315 URL: http://llvm.org/viewvc/llvm-project?rev=275315&view=rev Log: [OpenMP] add more tests for 'distribute parallel for simd' pragma This patch is to add two additional tests for testing 'distribute parallel for simd' pragma with disallowed clauses and loops. Differential Revision: http://reviews.llvm.org/D22169 Added: cfe/trunk/test/OpenMP/distribute_parallel_for_simd_loop_messages.cpp cfe/trunk/test/OpenMP/distribute_parallel_for_simd_misc_messages.c Added: cfe/trunk/test/OpenMP/distribute_parallel_for_simd_loop_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/distribute_parallel_for_simd_loop_messages.cpp?rev=275315&view=auto == --- cfe/trunk/test/OpenMP/distribute_parallel_for_simd_loop_messages.cpp (added) +++ cfe/trunk/test/OpenMP/distribute_parallel_for_simd_loop_messages.cpp Wed Jul 13 15:40:32 2016 @@ -0,0 +1,816 @@ +// RUN: %clang_cc1 -fsyntax-only -fopenmp -x c++ -std=c++11 -fexceptions -fcxx-exceptions -verify %s + +class S { + int a; + S() : a(0) {} + +public: + S(int v) : a(v) {} + S(const S &s) : a(s.a) {} +}; + +static int sii; +// expected-note@+1 {{defined as threadprivate or thread local}} +#pragma omp threadprivate(sii) +static int globalii; + +int test_iteration_spaces() { + const int N = 100; + float a[N], b[N], c[N]; + int ii, jj, kk; + float fii; + double dii; +#pragma omp target +#pragma omp teams +#pragma omp distribute parallel for simd + for (int i = 0; i < 10; i += 1) { +c[i] = a[i] + b[i]; + } +#pragma omp target +#pragma omp teams +#pragma omp distribute parallel for simd + for (char i = 0; i < 10; i++) { +c[i] = a[i] + b[i]; + } +#pragma omp target +#pragma omp teams +#pragma omp distribute parallel for simd + for (char i = 0; i < 10; i += '\1') { +c[i] = a[i] + b[i]; + } +#pragma omp target +#pragma omp teams +#pragma omp distribute parallel for simd + for (long long i = 0; i < 10; i++) { +c[i] = a[i] + b[i]; + } +#pragma omp target +#pragma omp teams +// expected-error@+2 {{expression must have integral or unscoped enumeration type, not 'double'}} +#pragma omp distribute parallel for simd + for (long long i = 0; i < 10; i += 1.5) { +c[i] = a[i] + b[i]; + } +#pragma omp target +#pragma omp teams +#pragma omp distribute parallel for simd + for (long long i = 0; i < 'z'; i += 1u) { +c[i] = a[i] + b[i]; + } +#pragma omp target +#pragma omp teams +// expected-error@+2 {{variable must be of integer or random access iterator type}} +#pragma omp distribute parallel for simd + for (float fi = 0; fi < 10.0; fi++) { +c[(int)fi] = a[(int)fi] + b[(int)fi]; + } +#pragma omp target +#pragma omp teams +// expected-error@+2 {{variable must be of integer or random access iterator type}} +#pragma omp distribute parallel for simd + for (double fi = 0; fi < 10.0; fi++) { +c[(int)fi] = a[(int)fi] + b[(int)fi]; + } +#pragma omp target +#pragma omp teams +// expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}} +#pragma omp distribute parallel for simd + for (int &ref = ii; ref < 10; ref++) { + } +#pragma omp target +#pragma omp teams +// expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}} +#pragma omp distribute parallel for simd + for (int i; i < 10; i++) +c[i] = a[i]; + +#pragma omp target +#pragma omp teams +// expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}} +#pragma omp distribute parallel for simd + for (int i = 0, j = 0; i < 10; ++i) +c[i] = a[i]; + +#pragma omp target +#pragma omp teams +// expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}} +#pragma omp distribute parallel for simd + for (; ii < 10; ++ii) +c[ii] = a[ii]; + +#pragma omp target +#pragma omp teams +// expected-warning@+3 {{expression result unused}} +// expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}} +#pragma omp distribute parallel for simd + for (ii + 1; ii < 10; ++ii) +c[ii] = a[ii]; + +#pragma omp target +#pragma omp teams +// expected-error@+2 {{initialization clause of OpenMP for loop is not in canonical form ('var = init' or 'T var = init')}} +#pragma omp distribute parallel for simd + for (c[ii] = 0; ii < 10; ++ii) +c[ii] = a[ii]; + +#pragma omp target +#pragma omp teams +// Ok to skip parenthesises. +#pragma omp distribute parallel for simd + for (((ii)) = 0; ii < 10; ++ii) +c[ii] = a[ii]; + +#pragma omp target +#pragma omp teams +// expected-error@+2 {{condition of OpenMP for loop must be a relational comparison ('<', '<=', '>', or '>=') of loop variable 'i'}} +#pragma omp distribute parallel
r275323 - [OpenMP] remove duplicate code in ActOnOpenMPRegionStart
Author: kli Date: Wed Jul 13 16:51:49 2016 New Revision: 275323 URL: http://llvm.org/viewvc/llvm-project?rev=275323&view=rev Log: [OpenMP] remove duplicate code in ActOnOpenMPRegionStart This patch is to remove duplicate code in ActOnOpenMPRegionStart. (NFC) Differential Revision: http://reviews.llvm.org/D22177 Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=275323&r1=275322&r2=275323&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Wed Jul 13 16:51:49 2016 @@ -1583,97 +1583,11 @@ public: void Sema::ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope) { switch (DKind) { - case OMPD_parallel: { -QualType KmpInt32Ty = Context.getIntTypeForBitwidth(32, 1); -QualType KmpInt32PtrTy = -Context.getPointerType(KmpInt32Ty).withConst().withRestrict(); -Sema::CapturedParamNameType Params[] = { -std::make_pair(".global_tid.", KmpInt32PtrTy), -std::make_pair(".bound_tid.", KmpInt32PtrTy), -std::make_pair(StringRef(), QualType()) // __context with shared vars -}; -ActOnCapturedRegionStart(DSAStack->getConstructLoc(), CurScope, CR_OpenMP, - Params); -break; - } - case OMPD_simd: { -Sema::CapturedParamNameType Params[] = { -std::make_pair(StringRef(), QualType()) // __context with shared vars -}; -ActOnCapturedRegionStart(DSAStack->getConstructLoc(), CurScope, CR_OpenMP, - Params); -break; - } - case OMPD_for: { -Sema::CapturedParamNameType Params[] = { -std::make_pair(StringRef(), QualType()) // __context with shared vars -}; -ActOnCapturedRegionStart(DSAStack->getConstructLoc(), CurScope, CR_OpenMP, - Params); -break; - } - case OMPD_for_simd: { -Sema::CapturedParamNameType Params[] = { -std::make_pair(StringRef(), QualType()) // __context with shared vars -}; -ActOnCapturedRegionStart(DSAStack->getConstructLoc(), CurScope, CR_OpenMP, - Params); -break; - } - case OMPD_sections: { -Sema::CapturedParamNameType Params[] = { -std::make_pair(StringRef(), QualType()) // __context with shared vars -}; -ActOnCapturedRegionStart(DSAStack->getConstructLoc(), CurScope, CR_OpenMP, - Params); -break; - } - case OMPD_section: { -Sema::CapturedParamNameType Params[] = { -std::make_pair(StringRef(), QualType()) // __context with shared vars -}; -ActOnCapturedRegionStart(DSAStack->getConstructLoc(), CurScope, CR_OpenMP, - Params); -break; - } - case OMPD_single: { -Sema::CapturedParamNameType Params[] = { -std::make_pair(StringRef(), QualType()) // __context with shared vars -}; -ActOnCapturedRegionStart(DSAStack->getConstructLoc(), CurScope, CR_OpenMP, - Params); -break; - } - case OMPD_master: { -Sema::CapturedParamNameType Params[] = { -std::make_pair(StringRef(), QualType()) // __context with shared vars -}; -ActOnCapturedRegionStart(DSAStack->getConstructLoc(), CurScope, CR_OpenMP, - Params); -break; - } - case OMPD_critical: { -Sema::CapturedParamNameType Params[] = { -std::make_pair(StringRef(), QualType()) // __context with shared vars -}; -ActOnCapturedRegionStart(DSAStack->getConstructLoc(), CurScope, CR_OpenMP, - Params); -break; - } - case OMPD_parallel_for: { -QualType KmpInt32Ty = Context.getIntTypeForBitwidth(32, 1); -QualType KmpInt32PtrTy = -Context.getPointerType(KmpInt32Ty).withConst().withRestrict(); -Sema::CapturedParamNameType Params[] = { -std::make_pair(".global_tid.", KmpInt32PtrTy), -std::make_pair(".bound_tid.", KmpInt32PtrTy), -std::make_pair(StringRef(), QualType()) // __context with shared vars -}; -ActOnCapturedRegionStart(DSAStack->getConstructLoc(), CurScope, CR_OpenMP, - Params); -break; - } - case OMPD_parallel_for_simd: { + case OMPD_parallel: + case OMPD_parallel_for: + case OMPD_parallel_for_simd: + case OMPD_parallel_sections: + case OMPD_teams: { QualType KmpInt32Ty = Context.getIntTypeForBitwidth(32, 1); QualType KmpInt32PtrTy = Context.getPointerType(KmpInt32Ty).withConst().withRestrict(); @@ -1686,13 +1600,23 @@ void Sema::ActOnOpenMPRegionStart(OpenMP Params); break; } - case OMPD_parallel_sections: { -QualType KmpInt32Ty = Context.getIntTypeForBitwidth(32, 1); -QualType KmpInt32PtrTy = -Context.getPointerType(KmpInt32Ty).withConst().withRestrict(); +
[PATCH] D22384: [OpenMP] add check for both simdlen and safelen clauses specified
kkwli0 created this revision. kkwli0 added reviewers: ABataev, sfantao, carlo.bertolli, arpith-jacob, hfinkel. kkwli0 added a subscriber: cfe-commits. This patch adds the check for specifying both simdlen and safelen clauses on the 'distribute simd' or 'distribute parallel for simd' constructs. https://reviews.llvm.org/D22384 Files: lib/Sema/SemaOpenMP.cpp test/OpenMP/distribute_parallel_for_simd_misc_messages.c test/OpenMP/distribute_simd_misc_messages.c test/OpenMP/target_parallel_for_simd_misc_messages.c Index: test/OpenMP/target_parallel_for_simd_misc_messages.c === --- test/OpenMP/target_parallel_for_simd_misc_messages.c +++ test/OpenMP/target_parallel_for_simd_misc_messages.c @@ -312,3 +312,184 @@ } } +void test_safelen() { + int i; +// expected-error@+1 {{expected '('}} +#pragma omp target parallel for simd safelen + for (i = 0; i < 16; ++i) +; +// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} +#pragma omp target parallel for simd safelen( + for (i = 0; i < 16; ++i) +; +// expected-error@+1 {{expected expression}} +#pragma omp target parallel for simd safelen() + for (i = 0; i < 16; ++i) +; +// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} +#pragma omp target parallel for simd safelen(, + for (i = 0; i < 16; ++i) +; +// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} +#pragma omp target parallel for simd safelen(, ) + for (i = 0; i < 16; ++i) +; +// expected-warning@+2 {{extra tokens at the end of '#pragma omp target parallel for simd' are ignored}} +// expected-error@+1 {{expected '('}} +#pragma omp target parallel for simd safelen 4) + for (i = 0; i < 16; ++i) +; +// expected-error@+2 {{expected ')'}} +// expected-note@+1 {{to match this '('}} +#pragma omp target parallel for simd safelen(4 + for (i = 0; i < 16; ++i) +; +// expected-error@+2 {{expected ')'}} +// expected-note@+1 {{to match this '('}} +#pragma omp target parallel for simd safelen(4, + for (i = 0; i < 16; ++i) +; +// expected-error@+2 {{expected ')'}} +// expected-note@+1 {{to match this '('}} +#pragma omp target parallel for simd safelen(4, ) + for (i = 0; i < 16; ++i) +; +#pragma omp target parallel for simd safelen(4) + for (i = 0; i < 16; ++i) +; +// expected-error@+2 {{expected ')'}} +// expected-note@+1 {{to match this '('}} +#pragma omp target parallel for simd safelen(4 4) + for (i = 0; i < 16; ++i) +; +// expected-error@+2 {{expected ')'}} +// expected-note@+1 {{to match this '('}} +#pragma omp target parallel for simd safelen(4, , 4) + for (i = 0; i < 16; ++i) +; +#pragma omp target parallel for simd safelen(4) + for (i = 0; i < 16; ++i) +; +// expected-error@+2 {{expected ')'}} +// expected-note@+1 {{to match this '('}} +#pragma omp target parallel for simd safelen(4, 8) + for (i = 0; i < 16; ++i) +; +// expected-error@+1 {{expression is not an integer constant expression}} +#pragma omp target parallel for simd safelen(2.5) + for (i = 0; i < 16; ++i) +; +// expected-error@+1 {{expression is not an integer constant expression}} +#pragma omp target parallel for simd safelen(foo()) + for (i = 0; i < 16; ++i) +; +// expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}} +#pragma omp target parallel for simd safelen(-5) + for (i = 0; i < 16; ++i) +; +// expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}} +#pragma omp target parallel for simd safelen(0) + for (i = 0; i < 16; ++i) +; +// expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}} +#pragma omp target parallel for simd safelen(5 - 5) + for (i = 0; i < 16; ++i) +; +} + +void test_simdlen() { + int i; +// expected-error@+1 {{expected '('}} +#pragma omp target parallel for simd simdlen + for (i = 0; i < 16; ++i) +; +// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} +#pragma omp target parallel for simd simdlen( + for (i = 0; i < 16; ++i) +; +// expected-error@+1 {{expected expression}} +#pragma omp target parallel for simd simdlen() + for (i = 0; i < 16; ++i) +; +// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} +#pragma omp target parallel for simd simdlen(, + for (i = 0; i < 16; ++i) +; +// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} +#pragma omp target parallel for simd simdlen(, ) + for (i = 0; i < 16; ++i) +; +// expected-warning@+2 {{extra tokens at the end of '#pragma omp target parallel for simd' are ignored}} +// expected-error@+1 {{ex
r275529 - [OpenMP] add check for both simdlen and safelen clauses specified
Author: kli Date: Thu Jul 14 23:39:07 2016 New Revision: 275529 URL: http://llvm.org/viewvc/llvm-project?rev=275529&view=rev Log: [OpenMP] add check for both simdlen and safelen clauses specified This patch adds the check for specifying both simdlen and safelen clauses on the 'distribute simd' or 'distribute parallel for simd' constructs. Differential Revision: https://reviews.llvm.org/D22384 Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/test/OpenMP/distribute_parallel_for_simd_misc_messages.c cfe/trunk/test/OpenMP/distribute_simd_misc_messages.c cfe/trunk/test/OpenMP/target_parallel_for_simd_misc_messages.c Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=275529&r1=275528&r2=275529&view=diff == --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Thu Jul 14 23:39:07 2016 @@ -5426,26 +5426,44 @@ static Expr *getOrderedNumberExpr(ArrayR return nullptr; } -static bool checkSimdlenSafelenValues(Sema &S, const Expr *Simdlen, - const Expr *Safelen) { - llvm::APSInt SimdlenRes, SafelenRes; - if (Simdlen->isValueDependent() || Simdlen->isTypeDependent() || - Simdlen->isInstantiationDependent() || - Simdlen->containsUnexpandedParameterPack()) -return false; - if (Safelen->isValueDependent() || Safelen->isTypeDependent() || - Safelen->isInstantiationDependent() || - Safelen->containsUnexpandedParameterPack()) -return false; - Simdlen->EvaluateAsInt(SimdlenRes, S.Context); - Safelen->EvaluateAsInt(SafelenRes, S.Context); - // OpenMP 4.1 [2.8.1, simd Construct, Restrictions] - // If both simdlen and safelen clauses are specified, the value of the simdlen - // parameter must be less than or equal to the value of the safelen parameter. - if (SimdlenRes > SafelenRes) { -S.Diag(Simdlen->getExprLoc(), diag::err_omp_wrong_simdlen_safelen_values) -<< Simdlen->getSourceRange() << Safelen->getSourceRange(); -return true; +static bool checkSimdlenSafelenSpecified(Sema &S, + const ArrayRef Clauses) { + OMPSafelenClause *Safelen = nullptr; + OMPSimdlenClause *Simdlen = nullptr; + + for (auto *Clause : Clauses) { +if (Clause->getClauseKind() == OMPC_safelen) + Safelen = cast(Clause); +else if (Clause->getClauseKind() == OMPC_simdlen) + Simdlen = cast(Clause); +if (Safelen && Simdlen) + break; + } + + if (Simdlen && Safelen) { +llvm::APSInt SimdlenRes, SafelenRes; +auto SimdlenLength = Simdlen->getSimdlen(); +auto SafelenLength = Safelen->getSafelen(); +if (SimdlenLength->isValueDependent() || SimdlenLength->isTypeDependent() || +SimdlenLength->isInstantiationDependent() || +SimdlenLength->containsUnexpandedParameterPack()) + return false; +if (SafelenLength->isValueDependent() || SafelenLength->isTypeDependent() || +SafelenLength->isInstantiationDependent() || +SafelenLength->containsUnexpandedParameterPack()) + return false; +SimdlenLength->EvaluateAsInt(SimdlenRes, S.Context); +SafelenLength->EvaluateAsInt(SafelenRes, S.Context); +// OpenMP 4.5 [2.8.1, simd Construct, Restrictions] +// If both simdlen and safelen clauses are specified, the value of the +// simdlen parameter must be less than or equal to the value of the safelen +// parameter. +if (SimdlenRes > SafelenRes) { + S.Diag(SimdlenLength->getExprLoc(), + diag::err_omp_wrong_simdlen_safelen_values) + << SimdlenLength->getSourceRange() << SafelenLength->getSourceRange(); + return true; +} } return false; } @@ -5481,22 +5499,7 @@ StmtResult Sema::ActOnOpenMPSimdDirectiv } } - // OpenMP 4.1 [2.8.1, simd Construct, Restrictions] - // If both simdlen and safelen clauses are specified, the value of the simdlen - // parameter must be less than or equal to the value of the safelen parameter. - OMPSafelenClause *Safelen = nullptr; - OMPSimdlenClause *Simdlen = nullptr; - for (auto *Clause : Clauses) { -if (Clause->getClauseKind() == OMPC_safelen) - Safelen = cast(Clause); -else if (Clause->getClauseKind() == OMPC_simdlen) - Simdlen = cast(Clause); -if (Safelen && Simdlen) - break; - } - if (Simdlen && Safelen && - checkSimdlenSafelenValues(*this, Simdlen->getSimdlen(), -Safelen->getSafelen())) + if (checkSimdlenSafelenSpecified(*this, Clauses)) return StmtError(); getCurFunction()->setHasBranchProtectedScope(); @@ -5572,22 +5575,7 @@ StmtResult Sema::ActOnOpenMPForSimdDirec } } - // OpenMP 4.1 [2.8.1, simd Construct, Restrictions] - // If both simdlen and safelen clauses are specified, the value of the simdlen - // parameter must be less than or equal to the val
Re: [PATCH] D22096: [OpenMP] Sema and parsing for 'target parallel for simd' pragma
I will take a look and put up a patch for it. Kelvin On Fri, Jul 15, 2016 at 2:46 AM, Alexey Bataev wrote: > Kelvin, > Please look at these messages and fix the tests. Or tell me and I will > fix them > > Best regards, > Alexey Bataev > = > Software Engineer > Intel Compiler Team > > 15.07.2016 9:23, Robinson, Paul пишет: > > > >> -Original Message- > >> From: Alexey Bataev [mailto:a.bat...@hotmail.com] > >> Sent: Thursday, July 14, 2016 7:51 PM > >> To: reviews+d22096+public+4c00789034d62...@reviews.llvm.org > >> Cc: cfe-commits@lists.llvm.org; kkw...@gmail.com; cber...@us.ibm.com; > >> sfan...@us.ibm.com; hfin...@anl.gov; acja...@us.ibm.com; Robinson, Paul > >> Subject: Re: [PATCH] D22096: [OpenMP] Sema and parsing for 'target > >> parallel for simd' pragma > >> > >> Hi Paul, > >> Could you provide a little bit more info about diagnostic you see? Maybe > >> the tests just need to be fixed > > That would be fine too. Log of the two failing tests attached. > > Thanks, > > --paulr > > > >> Best regards, > >> Alexey Bataev > >> = > >> Software Engineer > >> Intel Compiler Team > >> > >> 15.07.2016 2:09, Paul Robinson пишет: > >>> probinson added a subscriber: probinson. > >>> probinson added a comment. > >>> > >>> I'm seeing a different set of diagnostics in two of these tests, > because > >> we default to C+11, which makes them fail for us. Ideally you'd > >> conditionalize the tests on the value of `__cplusplus` (like Charles Li > >> has been doing for a whole lot of the Clang tests). If that's > >> inconvenient for you right now, would you mind if I added `-std=c++03` > to > >> the following tests? It's just these two that need it: > >>> target_parallel_for_simd_collapse_messages.cpp > >>> target_parallel_for_simd_ordered_messages.cpp > >>> > >>> > >>> Repository: > >>> rL LLVM > >>> > >>> https://reviews.llvm.org/D22096 > >>> > >>> > >>> > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D22096: [OpenMP] Sema and parsing for 'target parallel for simd' pragma
kkwli0 added a comment. I update the test cases in https://reviews.llvm.org/D22417. Repository: rL LLVM https://reviews.llvm.org/D22096 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D22417: [OpenMP] update test cases for -std=c++11 compile
kkwli0 added a subscriber: cfe-commits. kkwli0 added a comment. Add cfe-commits https://reviews.llvm.org/D22417 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r275805 - [OpenMP] update test cases for -std=c++11 compile
Author: kli Date: Mon Jul 18 11:09:53 2016 New Revision: 275805 URL: http://llvm.org/viewvc/llvm-project?rev=275805&view=rev Log: [OpenMP] update test cases for -std=c++11 compile target_parallel_for_simd_collapse_messages.cpp and target_parallel_for_simd_ordered_messages.cpp give different diagnostic messages in compiling with -std=c++11. The test cases are updated to make it compatible. Differential Revision: https://reviews.llvm.org/D22417 Modified: cfe/trunk/test/OpenMP/target_parallel_for_simd_collapse_messages.cpp cfe/trunk/test/OpenMP/target_parallel_for_simd_ordered_messages.cpp Modified: cfe/trunk/test/OpenMP/target_parallel_for_simd_collapse_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_parallel_for_simd_collapse_messages.cpp?rev=275805&r1=275804&r2=275805&view=diff == --- cfe/trunk/test/OpenMP/target_parallel_for_simd_collapse_messages.cpp (original) +++ cfe/trunk/test/OpenMP/target_parallel_for_simd_collapse_messages.cpp Mon Jul 18 11:09:53 2016 @@ -1,8 +1,13 @@ // RUN: %clang_cc1 -verify -fopenmp %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++98 %s +// RUN: %clang_cc1 -verify -fopenmp -std=c++11 %s void foo() { } +#if __cplusplus >= 201103L + // expected-note@+2 4 {{declared here}} +#endif bool foobool(int argc) { return argc; } @@ -11,6 +16,7 @@ struct S1; // expected-note {{declared h template // expected-note {{declared here}} T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} + int j; // expected-note {{declared here}} #pragma omp target parallel for simd collapse // expected-error {{expected '(' after 'collapse'}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; #pragma omp target parallel for simd collapse ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} @@ -29,6 +35,9 @@ T tmain(T argc, S **argv) { //expected-n for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; #pragma omp target parallel for simd collapse ((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'collapse' clause}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp target parallel for simd', but found only 1}} +#if __cplusplus >= 201103L + // expected-note@+5 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} +#endif // expected-error@+3 2 {{directive '#pragma omp target parallel for simd' cannot contain more than one 'collapse' clause}} // expected-error@+2 2 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+1 2 {{expression is not an integral constant expression}} @@ -36,8 +45,9 @@ T tmain(T argc, S **argv) { //expected-n for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; #pragma omp target parallel for simd collapse (S) // expected-error {{'S' does not refer to a value}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; - // expected-error@+1 2 {{expression is not an integral constant expression}} - #pragma omp target parallel for simd collapse (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} + // expected-note@+2 {{read of non-const variable 'j' is not allowed in a constant expression}} + // expected-error@+1 {{expression is not an integral constant expression}} + #pragma omp target parallel for simd collapse (j=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; #pragma omp target parallel for simd collapse (1) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; @@ -49,6 +59,7 @@ T tmain(T argc, S **argv) { //expected-n } int main(int argc, char **argv) { + int j; // expected-note {{declared here}} #pragma omp target parallel for simd collapse // expected-error {{expected '(' after 'collapse'}} for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp target parallel for simd collapse ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} @@ -59,8 +70,14 @@ int main(int argc, char **argv) { for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; // expected-error {{expected 4 for loops after '#pragma omp target parallel for simd', but found only 1}} #pragma omp target parallel for simd collapse (2+2)) // expected-warning {{extra tokens at the end of '#pragma omp target parallel for simd' are ignored}} expected-note {{as specified in 'collapse' clause}} for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; // expected-error {{expected 4 for loops after '#pragma omp target parallel for simd', but found only 1}} +#if __cp
Re: [PATCH] D15944: [OpenMP] Parsing and sema support for target update directive
kkwli0 marked 3 inline comments as done. Comment at: include/clang/AST/OpenMPClause.h:3196 @@ -3195,1 +3195,3 @@ +/// \brief This represents clause 'from' in the '#pragma omp ...' +/// directives. ABataev wrote: > New clauses must be added in separate patches after commit of the new > directive. Will do Comment at: lib/Parse/ParseOpenMP.cpp:71-74 @@ -69,3 +70,6 @@ !P.getPreprocessor().getSpelling(Tok).compare("point")) || -((i == 1) && !P.getPreprocessor().getSpelling(Tok).compare("data")); +((i == 1) && + !P.getPreprocessor().getSpelling(Tok).compare("data")) || +((i == 2) && + !P.getPreprocessor().getSpelling(Tok).compare("update")); } else { ABataev wrote: > Probably, we need to add local enumeric for these constants (0, 1, 2 etc.) Will use the latest infrastructure. http://reviews.llvm.org/D15944 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D15944: [OpenMP] Parsing and sema support for target update directive
kkwli0 updated this revision to Diff 50024. kkwli0 marked 2 inline comments as done. kkwli0 added a comment. I rebase the patch to the latest trunk and make use of the infrastructure form parsing and sema. http://reviews.llvm.org/D15944 Files: include/clang-c/Index.h include/clang/AST/OpenMPClause.h include/clang/AST/RecursiveASTVisitor.h include/clang/AST/StmtOpenMP.h include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/OpenMPKinds.def include/clang/Basic/StmtNodes.td include/clang/Sema/Sema.h include/clang/Serialization/ASTBitCodes.h lib/AST/OpenMPClause.cpp lib/AST/StmtOpenMP.cpp lib/AST/StmtPrinter.cpp lib/AST/StmtProfile.cpp lib/Basic/OpenMPKinds.cpp lib/CodeGen/CGStmt.cpp lib/CodeGen/CGStmtOpenMP.cpp lib/CodeGen/CodeGenFunction.h lib/Parse/ParseOpenMP.cpp lib/Sema/SemaOpenMP.cpp lib/Sema/TreeTransform.h lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp lib/StaticAnalyzer/Core/ExprEngine.cpp test/OpenMP/nesting_of_regions.cpp test/OpenMP/target_map_messages.cpp test/OpenMP/target_parallel_for_map_messages.cpp test/OpenMP/target_parallel_map_messages.cpp test/OpenMP/target_update_ast_print.cpp test/OpenMP/target_update_device_messages.cpp test/OpenMP/target_update_from_messages.cpp test/OpenMP/target_update_if_messages.cpp test/OpenMP/target_update_messages.cpp test/OpenMP/target_update_to_messages.cpp tools/libclang/CIndex.cpp tools/libclang/CXCursor.cpp Index: tools/libclang/CXCursor.cpp === --- tools/libclang/CXCursor.cpp +++ tools/libclang/CXCursor.cpp @@ -612,6 +612,9 @@ case Stmt::OMPTargetParallelForDirectiveClass: K = CXCursor_OMPTargetParallelForDirective; break; + case Stmt::OMPTargetUpdateDirectiveClass: +K = CXCursor_OMPTargetUpdateDirective; +break; case Stmt::OMPTeamsDirectiveClass: K = CXCursor_OMPTeamsDirective; break; Index: tools/libclang/CIndex.cpp === --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -2254,6 +2254,12 @@ } void OMPClauseEnqueue::VisitOMPDefaultmapClause( const OMPDefaultmapClause * /*C*/) {} +void OMPClauseEnqueue::VisitOMPFromClause(const OMPFromClause *C) { + VisitOMPClauseList(C); +} +void OMPClauseEnqueue::VisitOMPToClause(const OMPToClause *C) { + VisitOMPClauseList(C); +} } void EnqueueVisitor::EnqueueChildren(const OMPClause *S) { @@ -4824,6 +4830,8 @@ return cxstring::createRef("OMPTargetParallelDirective"); case CXCursor_OMPTargetParallelForDirective: return cxstring::createRef("OMPTargetParallelForDirective"); + case CXCursor_OMPTargetUpdateDirective: +return cxstring::createRef("OMPTargetUpdateDirective"); case CXCursor_OMPTeamsDirective: return cxstring::createRef("OMPTeamsDirective"); case CXCursor_OMPCancellationPointDirective: Index: test/OpenMP/target_update_to_messages.cpp === --- /dev/null +++ test/OpenMP/target_update_to_messages.cpp @@ -0,0 +1,175 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s + +void foo() { +} + +bool foobool(int argc) { + return argc; +} + +struct S1; // expected-note 2 {{declared here}} +extern S1 a; +class S2 { + mutable int a; +public: + S2():a(0) { } + S2(S2 &s2):a(s2.a) { } + static float S2s; // expected-note 4 {{mappable type cannot contain static members}} + static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}} +}; +const float S2::S2sc = 0; +const S2 b; +const S2 ba[5]; +class S3 { + int a; +public: + S3():a(0) { } + S3(S3 &s3):a(s3.a) { } +}; +const S3 c; +const S3 ca[5]; +extern const int f; +class S4 { + int a; + S4(); + S4(const S4 &s4); +public: + S4(int v):a(v) { } +}; +class S5 { + int a; + S5():a(0) {} + S5(const S5 &s5):a(s5.a) { } +public: + S5(int v):a(v) { } +}; +struct S6 { + int ii; + int aa[30]; + float xx; + double *pp; +}; +struct S7 { + int i; + int a[50]; + float x; + S6 s6[5]; + double *p; + unsigned bfa : 4; +}; + +S3 h; +#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} + +typedef int from; + +template // expected-note {{declared here}} +T tmain(T argc) { + const T d = 5; + const T da[5] = { 0 }; + S4 e(4); + S5 g(5); + T *m; + T i, t[20]; + T &j = i; + T *k = &j; + T x; + T y; + T to; + const T (&l)[5] = da; + S7 s7; + +#pragma omp target update to // expected-error {{expected '(' after 'to'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to()
Re: [PATCH] D15944: [OpenMP] Parsing and sema support for target update directive
kkwli0 updated this revision to Diff 50774. kkwli0 marked 5 inline comments as done. kkwli0 added a comment. Addressed the comments from the last review: added assert calls and outline the common code in ActOnOpenMPToClause, ActOnOpenMPFromClause and ActOnOpenMPMapClause to a static function. http://reviews.llvm.org/D15944 Files: include/clang-c/Index.h include/clang/AST/OpenMPClause.h include/clang/AST/RecursiveASTVisitor.h include/clang/AST/StmtOpenMP.h include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/OpenMPKinds.def include/clang/Basic/StmtNodes.td include/clang/Sema/Sema.h include/clang/Serialization/ASTBitCodes.h lib/AST/OpenMPClause.cpp lib/AST/StmtOpenMP.cpp lib/AST/StmtPrinter.cpp lib/AST/StmtProfile.cpp lib/Basic/OpenMPKinds.cpp lib/CodeGen/CGStmt.cpp lib/CodeGen/CGStmtOpenMP.cpp lib/CodeGen/CodeGenFunction.h lib/Parse/ParseOpenMP.cpp lib/Sema/SemaOpenMP.cpp lib/Sema/TreeTransform.h lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp lib/StaticAnalyzer/Core/ExprEngine.cpp test/OpenMP/nesting_of_regions.cpp test/OpenMP/target_map_messages.cpp test/OpenMP/target_parallel_for_map_messages.cpp test/OpenMP/target_parallel_map_messages.cpp test/OpenMP/target_update_ast_print.cpp test/OpenMP/target_update_device_messages.cpp test/OpenMP/target_update_from_messages.cpp test/OpenMP/target_update_if_messages.cpp test/OpenMP/target_update_messages.cpp test/OpenMP/target_update_to_messages.cpp tools/libclang/CIndex.cpp tools/libclang/CXCursor.cpp Index: tools/libclang/CXCursor.cpp === --- tools/libclang/CXCursor.cpp +++ tools/libclang/CXCursor.cpp @@ -612,6 +612,9 @@ case Stmt::OMPTargetParallelForDirectiveClass: K = CXCursor_OMPTargetParallelForDirective; break; + case Stmt::OMPTargetUpdateDirectiveClass: +K = CXCursor_OMPTargetUpdateDirective; +break; case Stmt::OMPTeamsDirectiveClass: K = CXCursor_OMPTeamsDirective; break; Index: tools/libclang/CIndex.cpp === --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -2255,6 +2255,12 @@ } void OMPClauseEnqueue::VisitOMPDefaultmapClause( const OMPDefaultmapClause * /*C*/) {} +void OMPClauseEnqueue::VisitOMPFromClause(const OMPFromClause *C) { + VisitOMPClauseList(C); +} +void OMPClauseEnqueue::VisitOMPToClause(const OMPToClause *C) { + VisitOMPClauseList(C); +} } void EnqueueVisitor::EnqueueChildren(const OMPClause *S) { @@ -4825,6 +4831,8 @@ return cxstring::createRef("OMPTargetParallelDirective"); case CXCursor_OMPTargetParallelForDirective: return cxstring::createRef("OMPTargetParallelForDirective"); + case CXCursor_OMPTargetUpdateDirective: +return cxstring::createRef("OMPTargetUpdateDirective"); case CXCursor_OMPTeamsDirective: return cxstring::createRef("OMPTeamsDirective"); case CXCursor_OMPCancellationPointDirective: Index: test/OpenMP/target_update_to_messages.cpp === --- /dev/null +++ test/OpenMP/target_update_to_messages.cpp @@ -0,0 +1,175 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s + +void foo() { +} + +bool foobool(int argc) { + return argc; +} + +struct S1; // expected-note 2 {{declared here}} +extern S1 a; +class S2 { + mutable int a; +public: + S2():a(0) { } + S2(S2 &s2):a(s2.a) { } + static float S2s; // expected-note 4 {{mappable type cannot contain static members}} + static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}} +}; +const float S2::S2sc = 0; +const S2 b; +const S2 ba[5]; +class S3 { + int a; +public: + S3():a(0) { } + S3(S3 &s3):a(s3.a) { } +}; +const S3 c; +const S3 ca[5]; +extern const int f; +class S4 { + int a; + S4(); + S4(const S4 &s4); +public: + S4(int v):a(v) { } +}; +class S5 { + int a; + S5():a(0) {} + S5(const S5 &s5):a(s5.a) { } +public: + S5(int v):a(v) { } +}; +struct S6 { + int ii; + int aa[30]; + float xx; + double *pp; +}; +struct S7 { + int i; + int a[50]; + float x; + S6 s6[5]; + double *p; + unsigned bfa : 4; +}; + +S3 h; +#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} + +typedef int from; + +template // expected-note {{declared here}} +T tmain(T argc) { + const T d = 5; + const T da[5] = { 0 }; + S4 e(4); + S5 g(5); + T *m; + T i, t[20]; + T &j = i; + T *k = &j; + T x; + T y; + T to; + const T (&l)[5] = da; + S7 s7; + +#pragma omp target update to // expected-error {{expected '(' after 'to'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or
Re: [PATCH] D15944: [OpenMP] Parsing and sema support for target update directive
kkwli0 added a comment. Thanks for the review. As request, I will split this patch into two: 1. to and from clause (without test cases) 2. target update directive (with test cases) I will use this review for the target update directive. http://reviews.llvm.org/D15944 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D15944: [OpenMP] Parsing and sema support for target update directive
kkwli0 added a comment. Patch for the to and from clauses is in http://reviews.llvm.org/D18488. http://reviews.llvm.org/D15944 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D15944: [OpenMP] Parsing and sema support for target update directive
kkwli0 created this revision. kkwli0 added reviewers: ABataev, rsmith, fraggamuffin, sfantao, hfinkel, carlo.bertolli. kkwli0 added a subscriber: cfe-commits. This patch is to add parsing and sema support for target update directive. It also includes the to and from clause as it is required to specified one of the two clauses. http://reviews.llvm.org/D15944 Files: include/clang-c/Index.h include/clang/AST/OpenMPClause.h include/clang/AST/RecursiveASTVisitor.h include/clang/AST/StmtOpenMP.h include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/OpenMPKinds.def include/clang/Basic/StmtNodes.td include/clang/Sema/Sema.h include/clang/Serialization/ASTBitCodes.h lib/AST/OpenMPClause.cpp lib/AST/StmtOpenMP.cpp lib/AST/StmtPrinter.cpp lib/AST/StmtProfile.cpp lib/Basic/OpenMPKinds.cpp lib/CodeGen/CGStmt.cpp lib/CodeGen/CGStmtOpenMP.cpp lib/CodeGen/CodeGenFunction.h lib/Parse/ParseOpenMP.cpp lib/Sema/SemaOpenMP.cpp lib/Sema/TreeTransform.h lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp lib/StaticAnalyzer/Core/ExprEngine.cpp test/OpenMP/target_map_messages.cpp test/OpenMP/target_update_ast_print.cpp test/OpenMP/target_update_device_messages.cpp test/OpenMP/target_update_from_messages.cpp test/OpenMP/target_update_if_messages.cpp test/OpenMP/target_update_to_messages.cpp tools/libclang/CIndex.cpp tools/libclang/CXCursor.cpp Index: tools/libclang/CXCursor.cpp === --- tools/libclang/CXCursor.cpp +++ tools/libclang/CXCursor.cpp @@ -600,6 +600,9 @@ case Stmt::OMPTargetDataDirectiveClass: K = CXCursor_OMPTargetDataDirective; break; + case Stmt::OMPTargetUpdateDirectiveClass: +K = CXCursor_OMPTargetUpdateDirective; +break; case Stmt::OMPTeamsDirectiveClass: K = CXCursor_OMPTeamsDirective; break; Index: tools/libclang/CIndex.cpp === --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -2218,6 +2218,12 @@ void OMPClauseEnqueue::VisitOMPMapClause(const OMPMapClause *C) { VisitOMPClauseList(C); } +void OMPClauseEnqueue::VisitOMPFromClause(const OMPFromClause *C) { + VisitOMPClauseList(C); +} +void OMPClauseEnqueue::VisitOMPToClause(const OMPToClause *C) { + VisitOMPClauseList(C); +} } void EnqueueVisitor::EnqueueChildren(const OMPClause *S) { @@ -4506,6 +4512,8 @@ return cxstring::createRef("OMPTargetDirective"); case CXCursor_OMPTargetDataDirective: return cxstring::createRef("OMPTargetDataDirective"); + case CXCursor_OMPTargetUpdateDirective: +return cxstring::createRef("OMPTargetUpdateDirective"); case CXCursor_OMPTeamsDirective: return cxstring::createRef("OMPTeamsDirective"); case CXCursor_OMPCancellationPointDirective: Index: test/OpenMP/target_update_to_messages.cpp === --- /dev/null +++ test/OpenMP/target_update_to_messages.cpp @@ -0,0 +1,127 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s + +void foo() { +} + +bool foobool(int argc) { + return argc; +} + +struct S1; // expected-note 2 {{declared here}} +extern S1 a; +class S2 { + mutable int a; +public: + S2():a(0) { } + S2(S2 &s2):a(s2.a) { } + static float S2s; // expected-note 4 {{mappable type cannot contain static members}} + static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}} +}; +const float S2::S2sc = 0; +const S2 b; +const S2 ba[5]; +class S3 { + int a; +public: + S3():a(0) { } + S3(S3 &s3):a(s3.a) { } +}; +const S3 c; +const S3 ca[5]; +extern const int f; +class S4 { + int a; + S4(); + S4(const S4 &s4); +public: + S4(int v):a(v) { } +}; +class S5 { + int a; + S5():a(0) {} + S5(const S5 &s5):a(s5.a) { } +public: + S5(int v):a(v) { } +}; + +S3 h; +#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} + +typedef int from; + +template // expected-note {{declared here}} +T tmain(T argc) { + const T d = 5; + const T da[5] = { 0 }; + S4 e(4); + S5 g(5); + T i, t[20]; + T &j = i; + T *k = &j; + T x; + T y; + T to; + const T (&l)[5] = da; + +#pragma omp target update to // expected-error {{expected '(' after 'to'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to() // expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update() // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} expe
Re: [PATCH] D14134: [OpenMP] Parsing and sema support for map clause
kkwli0 updated this revision to Diff 40176. kkwli0 added a comment. Update the patch after the first review. http://reviews.llvm.org/D14134 Files: include/clang/AST/DataRecursiveASTVisitor.h include/clang/AST/OpenMPClause.h include/clang/AST/RecursiveASTVisitor.h include/clang/Basic/DiagnosticParseKinds.td include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/OpenMPKinds.def include/clang/Basic/OpenMPKinds.h include/clang/Sema/Sema.h lib/AST/OpenMPClause.cpp lib/AST/StmtPrinter.cpp lib/AST/StmtProfile.cpp lib/Basic/OpenMPKinds.cpp lib/CodeGen/CGStmtOpenMP.cpp lib/Parse/ParseOpenMP.cpp lib/Sema/SemaOpenMP.cpp lib/Sema/TreeTransform.h lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp test/OpenMP/target_ast_print.cpp test/OpenMP/target_data_ast_print.cpp test/OpenMP/target_map_messages.cpp tools/libclang/CIndex.cpp Index: tools/libclang/CIndex.cpp === --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -2171,6 +2171,9 @@ void OMPClauseEnqueue::VisitOMPDependClause(const OMPDependClause *C) { VisitOMPClauseList(C); } +void OMPClauseEnqueue::VisitOMPMapClause(const OMPMapClause *C) { + VisitOMPClauseList(C); +} } void EnqueueVisitor::EnqueueChildren(const OMPClause *S) { Index: test/OpenMP/target_map_messages.cpp === --- /dev/null +++ test/OpenMP/target_map_messages.cpp @@ -0,0 +1,119 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s + +void foo() { +} + +bool foobool(int argc) { + return argc; +} + +struct S1; // expected-note {{declared here}} +extern S1 a; +class S2 { + mutable int a; +public: + S2():a(0) { } + S2(S2 &s2):a(s2.a) { } + static float S2s; // expected-note 2 {{mappable type cannot contain static members}} + static const float S2sc; // expected-note 2 {{mappable type cannot contain static members}} +}; +const float S2::S2sc = 0; +const S2 b; +const S2 ba[5]; +class S3 { + int a; +public: + S3():a(0) { } + S3(S3 &s3):a(s3.a) { } +}; +const S3 c; +const S3 ca[5]; +extern const int f; +class S4 { + int a; + S4(); + S4(const S4 &s4); +public: + S4(int v):a(v) { } +}; +class S5 { + int a; + S5():a(0) {} + S5(const S5 &s5):a(s5.a) { } +public: + S5(int v):a(v) { } +}; + +S3 h; +#pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}} + +int main(int argc, char **argv) { + const int d = 5; + const int da[5] = { 0 }; + S4 e(4); + S5 g(5); + int i; + int &j = i; + int *k = &j; + int x; + int y; + int to, tofrom, always; + const int (&l)[5] = da; + #pragma omp target map // expected-error {{expected '(' after 'map'}} + #pragma omp target map ( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} + #pragma omp target map () // expected-error {{expected expression}} + #pragma omp target map (alloc) // expected-error {{use of undeclared identifier 'alloc'}} + #pragma omp target map (to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}} + #pragma omp target map (to:) // expected-error {{expected expression}} + #pragma omp target map (from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp target map (x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} + #pragma omp target map (x) + foo(); + #pragma omp target map (to: x) + foo(); + #pragma omp target map (to: to) + foo(); + #pragma omp target map (to) + foo(); + #pragma omp target map (to, x) + foo(); + #pragma omp target map (to x) // expected-error {{expected ',' or ')' in 'map' clause}} + #pragma omp target map (tofrom: argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name, array element or array section}} + #pragma omp target map (argc) + #pragma omp target map (S1) // expected-error {{'S1' does not refer to a value}} + #pragma omp target map (a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}} + #pragma omp target map (argv[1]) + #pragma omp target map(ba) // expected-error 2 {{type 'S2' is not mappable to target}} + #pragma omp target map(ca) + #pragma omp target map(da) + #pragma omp target map(S2::S2s) + #pragma omp target map(S2::S2sc) + #pragma omp target map(e, g) + #pragma omp target map(h) // expected-error {{threadprivate variables are not allowed in map clause}} + #pragma omp target map(k), map(k) // expected-error {{variable already marked as mapped in current construct}} expected-note {{used here}} + #pragma omp target map(k), map(k[:5]) // expected-error {{variable already marked as mapped in current construct}} expecte
Re: [PATCH] D14134: [OpenMP] Parsing and sema support for map clause
kkwli0 marked 6 inline comments as done. kkwli0 added a comment. Address the comments and will post an updated patch. http://reviews.llvm.org/D14134 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D14134: [OpenMP] Parsing and sema support for map clause
kkwli0 updated this revision to Diff 40537. kkwli0 added a comment. Updated patch with the 2nd review comments addressed. http://reviews.llvm.org/D14134 Files: include/clang/AST/DataRecursiveASTVisitor.h include/clang/AST/OpenMPClause.h include/clang/AST/RecursiveASTVisitor.h include/clang/Basic/DiagnosticParseKinds.td include/clang/Basic/DiagnosticSemaKinds.td include/clang/Basic/OpenMPKinds.def include/clang/Basic/OpenMPKinds.h include/clang/Sema/Sema.h lib/AST/OpenMPClause.cpp lib/AST/StmtPrinter.cpp lib/AST/StmtProfile.cpp lib/Basic/OpenMPKinds.cpp lib/CodeGen/CGStmtOpenMP.cpp lib/Parse/ParseOpenMP.cpp lib/Sema/SemaOpenMP.cpp lib/Sema/TreeTransform.h lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp test/OpenMP/target_ast_print.cpp test/OpenMP/target_data_ast_print.cpp test/OpenMP/target_map_messages.cpp tools/libclang/CIndex.cpp Index: tools/libclang/CIndex.cpp === --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -2178,6 +2178,9 @@ void OMPClauseEnqueue::VisitOMPDependClause(const OMPDependClause *C) { VisitOMPClauseList(C); } +void OMPClauseEnqueue::VisitOMPMapClause(const OMPMapClause *C) { + VisitOMPClauseList(C); +} } void EnqueueVisitor::EnqueueChildren(const OMPClause *S) { Index: test/OpenMP/target_map_messages.cpp === --- /dev/null +++ test/OpenMP/target_map_messages.cpp @@ -0,0 +1,207 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s + +void foo() { +} + +bool foobool(int argc) { + return argc; +} + +struct S1; // expected-note 2 {{declared here}} +extern S1 a; +class S2 { + mutable int a; +public: + S2():a(0) { } + S2(S2 &s2):a(s2.a) { } + static float S2s; // expected-note 4 {{mappable type cannot contain static members}} + static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}} +}; +const float S2::S2sc = 0; +const S2 b; +const S2 ba[5]; +class S3 { + int a; +public: + S3():a(0) { } + S3(S3 &s3):a(s3.a) { } +}; +const S3 c; +const S3 ca[5]; +extern const int f; +class S4 { + int a; + S4(); + S4(const S4 &s4); +public: + S4(int v):a(v) { } +}; +class S5 { + int a; + S5():a(0) {} + S5(const S5 &s5):a(s5.a) { } +public: + S5(int v):a(v) { } +}; + +S3 h; +#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} + +typedef int from; + +template // expected-note {{declared here}} +T tmain(T argc) { + const T d = 5; + const T da[5] = { 0 }; + S4 e(4); + S5 g(5); + T i, t[20]; + T &j = i; + T *k = &j; + T x; + T y; + T to, tofrom, always; + const T (&l)[5] = da; + + +#pragma omp target map // expected-error {{expected '(' after 'map'}} +#pragma omp target map( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} +#pragma omp target map() // expected-error {{expected expression}} +#pragma omp target map(alloc) // expected-error {{use of undeclared identifier 'alloc'}} +#pragma omp target map(to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}} +#pragma omp target map(to:) // expected-error {{expected expression}} +#pragma omp target map(from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp target map(x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} +#pragma omp target map(x) + foo(); +#pragma omp target map(tofrom: t[:I]) + foo(); +#pragma omp target map(T: a) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} + foo(); +#pragma omp target map(T) // expected-error {{'T' does not refer to a value}} + foo(); +#pragma omp target map(I) // expected-error 2 {{expected variable name, array element or array section}} + foo(); +#pragma omp target map(S2::S2s) + foo(); +#pragma omp target map(S2::S2sc) + foo(); +#pragma omp target map(x) + foo(); +#pragma omp target map(to: x) + foo(); +#pragma omp target map(to: to) + foo(); +#pragma omp target map(to) + foo(); +#pragma omp target map(to, x) + foo(); +#pragma omp target map(to x) // expected-error {{expected ',' or ')' in 'map' clause}} +#pragma omp target map(tofrom: argc > 0 ? x : y) // expected-error 2 {{expected variable name, array element or array section}} +#pragma omp target map(argc) +#pragma omp target map(S1) // expected-error {{'S1' does not refer to a value}} +#pragma omp target map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}} +#pragma omp target map(ba) // expected-error 2 {{type 'S2' is not mappable to target}} +#pragma omp target map(ca) +#pragma omp t
r253849 - [OpenMP] Parsing and sema support for map clause
Author: kli Date: Sun Nov 22 23:32:03 2015 New Revision: 253849 URL: http://llvm.org/viewvc/llvm-project?rev=253849&view=rev Log: [OpenMP] Parsing and sema support for map clause http://reviews.llvm.org/D14134 Modified: cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h cfe/trunk/include/clang/AST/OpenMPClause.h cfe/trunk/include/clang/AST/RecursiveASTVisitor.h cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/include/clang/Basic/OpenMPKinds.def cfe/trunk/include/clang/Basic/OpenMPKinds.h cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/AST/OpenMPClause.cpp cfe/trunk/lib/AST/StmtPrinter.cpp cfe/trunk/lib/AST/StmtProfile.cpp cfe/trunk/lib/Basic/OpenMPKinds.cpp cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp cfe/trunk/lib/Parse/ParseOpenMP.cpp cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/lib/Sema/TreeTransform.h cfe/trunk/lib/Serialization/ASTReaderStmt.cpp cfe/trunk/lib/Serialization/ASTWriterStmt.cpp cfe/trunk/test/OpenMP/target_ast_print.cpp cfe/trunk/test/OpenMP/target_data_ast_print.cpp cfe/trunk/tools/libclang/CIndex.cpp Modified: cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h?rev=253849&r1=253848&r2=253849&view=diff == --- cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h (original) +++ cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h Sun Nov 22 23:32:03 2015 @@ -2707,6 +2707,12 @@ bool RecursiveASTVisitor::Visit return true; } +template +bool RecursiveASTVisitor::VisitOMPMapClause(OMPMapClause *C) { + TRY_TO(VisitOMPClauseList(C)); + return true; +} + // FIXME: look at the following tricky-seeming exprs to see if we // need to recurse on anything. These are ones that have methods // returning decls or qualtypes or nestednamespecifier -- though I'm Modified: cfe/trunk/include/clang/AST/OpenMPClause.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=253849&r1=253848&r2=253849&view=diff == --- cfe/trunk/include/clang/AST/OpenMPClause.h (original) +++ cfe/trunk/include/clang/AST/OpenMPClause.h Sun Nov 22 23:32:03 2015 @@ -2613,6 +2613,121 @@ public: } }; +/// \brief This represents clause 'map' in the '#pragma omp ...' +/// directives. +/// +/// \code +/// #pragma omp target map(a,b) +/// \endcode +/// In this example directive '#pragma omp target' has clause 'map' +/// with the variables 'a' and 'b'. +/// +class OMPMapClause : public OMPVarListClause { + friend class OMPClauseReader; + + /// \brief Map type modifier for the 'map' clause. + OpenMPMapClauseKind MapTypeModifier; + /// \brief Map type for the 'map' clause. + OpenMPMapClauseKind MapType; + /// \brief Location of the map type. + SourceLocation MapLoc; + /// \brief Colon location. + SourceLocation ColonLoc; + + /// \brief Set type modifier for the clause. + /// + /// \param T Type Modifier for the clause. + /// + void setMapTypeModifier(OpenMPMapClauseKind T) { MapTypeModifier = T; } + + /// \brief Set type for the clause. + /// + /// \param T Type for the clause. + /// + void setMapType(OpenMPMapClauseKind T) { MapType = T; } + + /// \brief Set type location. + /// + /// \param TLoc Type location. + /// + void setMapLoc(SourceLocation TLoc) { MapLoc = TLoc; } + + /// \brief Set colon location. + void setColonLoc(SourceLocation Loc) { ColonLoc = Loc; } + + /// \brief Build clause with number of variables \a N. + /// + /// \param MayTypeModifier Map type modifier. + /// \param MapType Map type. + /// \param MapLoc Location of the map type. + /// \param StartLoc Starting location of the clause. + /// \param EndLoc Ending location of the clause. + /// \param N Number of the variables in the clause. + /// + explicit OMPMapClause(OpenMPMapClauseKind MapTypeModifier, +OpenMPMapClauseKind MapType, SourceLocation MapLoc, +SourceLocation StartLoc, SourceLocation LParenLoc, +SourceLocation EndLoc, unsigned N) +: OMPVarListClause(OMPC_map, StartLoc, LParenLoc, EndLoc, N), + MapTypeModifier(MapTypeModifier), MapType(MapType), MapLoc(MapLoc) {} + + /// \brief Build an empty clause. + /// + /// \param N Number of variables. + /// + explicit OMPMapClause(unsigned N) + : OMPVarListClause(OMPC_map, SourceLocation(), + SourceLocation(), SourceLocation(), N), +MapTypeModifier(OMPC_MAP_unknown), MapType(OMPC_MAP_unknown), MapLoc() {} + +public: + /// \brief Creates clause with a list of variables \a VL. + /// + /// \param C AST context. + /// \brief StartLoc Starting location of the clause. + /// \brief EndLoc Ending loca
r253850 - [OpenMP] Parsing and sema support for map clause - add test case
Author: kli Date: Sun Nov 22 23:36:37 2015 New Revision: 253850 URL: http://llvm.org/viewvc/llvm-project?rev=253850&view=rev Log: [OpenMP] Parsing and sema support for map clause - add test case http://reviews.llvm.org/D14134 Added: cfe/trunk/test/OpenMP/target_map_messages.cpp Added: cfe/trunk/test/OpenMP/target_map_messages.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_map_messages.cpp?rev=253850&view=auto == --- cfe/trunk/test/OpenMP/target_map_messages.cpp (added) +++ cfe/trunk/test/OpenMP/target_map_messages.cpp Sun Nov 22 23:36:37 2015 @@ -0,0 +1,207 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s + +void foo() { +} + +bool foobool(int argc) { + return argc; +} + +struct S1; // expected-note 2 {{declared here}} +extern S1 a; +class S2 { + mutable int a; +public: + S2():a(0) { } + S2(S2 &s2):a(s2.a) { } + static float S2s; // expected-note 4 {{mappable type cannot contain static members}} + static const float S2sc; // expected-note 4 {{mappable type cannot contain static members}} +}; +const float S2::S2sc = 0; +const S2 b; +const S2 ba[5]; +class S3 { + int a; +public: + S3():a(0) { } + S3(S3 &s3):a(s3.a) { } +}; +const S3 c; +const S3 ca[5]; +extern const int f; +class S4 { + int a; + S4(); + S4(const S4 &s4); +public: + S4(int v):a(v) { } +}; +class S5 { + int a; + S5():a(0) {} + S5(const S5 &s5):a(s5.a) { } +public: + S5(int v):a(v) { } +}; + +S3 h; +#pragma omp threadprivate(h) // expected-note 2 {{defined as threadprivate or thread local}} + +typedef int from; + +template // expected-note {{declared here}} +T tmain(T argc) { + const T d = 5; + const T da[5] = { 0 }; + S4 e(4); + S5 g(5); + T i, t[20]; + T &j = i; + T *k = &j; + T x; + T y; + T to, tofrom, always; + const T (&l)[5] = da; + + +#pragma omp target map // expected-error {{expected '(' after 'map'}} +#pragma omp target map( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}} +#pragma omp target map() // expected-error {{expected expression}} +#pragma omp target map(alloc) // expected-error {{use of undeclared identifier 'alloc'}} +#pragma omp target map(to argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected ',' or ')' in 'map' clause}} +#pragma omp target map(to:) // expected-error {{expected expression}} +#pragma omp target map(from: argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp target map(x: y) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} +#pragma omp target map(x) + foo(); +#pragma omp target map(tofrom: t[:I]) + foo(); +#pragma omp target map(T: a) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} + foo(); +#pragma omp target map(T) // expected-error {{'T' does not refer to a value}} + foo(); +#pragma omp target map(I) // expected-error 2 {{expected variable name, array element or array section}} + foo(); +#pragma omp target map(S2::S2s) + foo(); +#pragma omp target map(S2::S2sc) + foo(); +#pragma omp target map(x) + foo(); +#pragma omp target map(to: x) + foo(); +#pragma omp target map(to: to) + foo(); +#pragma omp target map(to) + foo(); +#pragma omp target map(to, x) + foo(); +#pragma omp target map(to x) // expected-error {{expected ',' or ')' in 'map' clause}} +#pragma omp target map(tofrom: argc > 0 ? x : y) // expected-error 2 {{expected variable name, array element or array section}} +#pragma omp target map(argc) +#pragma omp target map(S1) // expected-error {{'S1' does not refer to a value}} +#pragma omp target map(a, b, c, d, f) // expected-error {{incomplete type 'S1' where a complete type is required}} expected-error 2 {{type 'S2' is not mappable to target}} +#pragma omp target map(ba) // expected-error 2 {{type 'S2' is not mappable to target}} +#pragma omp target map(ca) +#pragma omp target map(da) +#pragma omp target map(S2::S2s) +#pragma omp target map(S2::S2sc) +#pragma omp target map(e, g) +#pragma omp target map(h) // expected-error {{threadprivate variables are not allowed in map clause}} +#pragma omp target map(k), map(k) // expected-error 2 {{variable already marked as mapped in current construct}} expected-note 2 {{used here}} +#pragma omp target map(k), map(k[:5]) // expected-error 2 {{variable already marked as mapped in current construct}} expected-note 2 {{used here}} + foo(); +#pragma omp target map(da) +#pragma omp target map(da[:4]) + foo(); +#pragma omp target map(k, j, l) // expected-note 4 {{used here}} +#pragma omp target map(k[:4]) // expected-error 2 {{variable already marked as mapped in current construct}} +#pragma omp target map(j) +#pragma omp target map(l[:5]) // expected-error 2 {{var
Re: [PATCH] D14134: [OpenMP] Parsing and sema support for map clause
kkwli0 closed this revision. kkwli0 added a comment. Committed revision 253849. Committed revision 253850. http://reviews.llvm.org/D14134 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r254019 - [OpenMP] Parsing and sema support for num_teams clause
Author: kli Date: Tue Nov 24 14:50:12 2015 New Revision: 254019 URL: http://llvm.org/viewvc/llvm-project?rev=254019&view=rev Log: [OpenMP] Parsing and sema support for num_teams clause http://reviews.llvm.org/D14802 Added: cfe/trunk/test/OpenMP/teams_num_teams_messages.cpp Modified: cfe/trunk/include/clang/AST/OpenMPClause.h cfe/trunk/include/clang/AST/RecursiveASTVisitor.h cfe/trunk/include/clang/Basic/OpenMPKinds.def cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/AST/StmtPrinter.cpp cfe/trunk/lib/AST/StmtProfile.cpp cfe/trunk/lib/Basic/OpenMPKinds.cpp cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp cfe/trunk/lib/Parse/ParseOpenMP.cpp cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/lib/Sema/TreeTransform.h cfe/trunk/lib/Serialization/ASTReaderStmt.cpp cfe/trunk/lib/Serialization/ASTWriterStmt.cpp cfe/trunk/test/OpenMP/teams_ast_print.cpp cfe/trunk/tools/libclang/CIndex.cpp Modified: cfe/trunk/include/clang/AST/OpenMPClause.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=254019&r1=254018&r2=254019&view=diff == --- cfe/trunk/include/clang/AST/OpenMPClause.h (original) +++ cfe/trunk/include/clang/AST/OpenMPClause.h Tue Nov 24 14:50:12 2015 @@ -2728,6 +2728,61 @@ public: } }; +/// \brief This represents 'num_teams' clause in the '#pragma omp ...' +/// directive. +/// +/// \code +/// #pragma omp teams num_teams(n) +/// \endcode +/// In this example directive '#pragma omp teams' has clause 'num_teams' +/// with single expression 'n'. +/// +class OMPNumTeamsClause : public OMPClause { + friend class OMPClauseReader; + /// \brief Location of '('. + SourceLocation LParenLoc; + /// \brief NumTeams number. + Stmt *NumTeams; + /// \brief Set the NumTeams number. + /// + /// \param E NumTeams number. + /// + void setNumTeams(Expr *E) { NumTeams = E; } + +public: + /// \brief Build 'num_teams' clause. + /// + /// \param E Expression associated with this clause. + /// \param StartLoc Starting location of the clause. + /// \param LParenLoc Location of '('. + /// \param EndLoc Ending location of the clause. + /// + OMPNumTeamsClause(Expr *E, SourceLocation StartLoc, SourceLocation LParenLoc, +SourceLocation EndLoc) + : OMPClause(OMPC_num_teams, StartLoc, EndLoc), LParenLoc(LParenLoc), +NumTeams(E) {} + + /// \brief Build an empty clause. + /// + OMPNumTeamsClause() + : OMPClause(OMPC_num_teams, SourceLocation(), SourceLocation()), +LParenLoc(SourceLocation()), NumTeams(nullptr) {} + /// \brief Sets the location of '('. + void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } + /// \brief Returns the location of '('. + SourceLocation getLParenLoc() const { return LParenLoc; } + /// \brief Return NumTeams number. + Expr *getNumTeams() { return cast(NumTeams); } + /// \brief Return NumTeams number. + Expr *getNumTeams() const { return cast(NumTeams); } + + static bool classof(const OMPClause *T) { +return T->getClauseKind() == OMPC_num_teams; + } + + child_range children() { return child_range(&NumTeams, &NumTeams + 1); } +}; + } // end namespace clang #endif // LLVM_CLANG_AST_OPENMPCLAUSE_H Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=254019&r1=254018&r2=254019&view=diff == --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original) +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Tue Nov 24 14:50:12 2015 @@ -2717,6 +2717,13 @@ bool RecursiveASTVisitor::Visit return true; } +template +bool RecursiveASTVisitor::VisitOMPNumTeamsClause( +OMPNumTeamsClause *C) { + TRY_TO(TraverseStmt(C->getNumTeams())); + return true; +} + // FIXME: look at the following tricky-seeming exprs to see if we // need to recurse on anything. These are ones that have methods // returning decls or qualtypes or nestednamespecifier -- though I'm Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=254019&r1=254018&r2=254019&view=diff == --- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original) +++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Tue Nov 24 14:50:12 2015 @@ -150,6 +150,7 @@ OPENMP_CLAUSE(device, OMPDeviceClause) OPENMP_CLAUSE(threads, OMPThreadsClause) OPENMP_CLAUSE(simd, OMPSIMDClause) OPENMP_CLAUSE(map, OMPMapClause) +OPENMP_CLAUSE(num_teams, OMPNumTeamsClause) // Clauses allowed for OpenMP directive 'parallel'. OPENMP_PARALLEL_CLAUSE(if) @@ -321,6 +322,7 @@ OPENMP_TEAMS_CLAUSE(private) OPENMP_TEAMS_CLAUSE(firstprivate) OPENMP_TEAMS_CLAUSE(shared) OPENMP_TEAMS_CLAUSE(reduction)
[PATCH] D15029: [OpenMP] Parsing and sema support for thread_limit clause
kkwli0 created this revision. kkwli0 added reviewers: ABataev, hfinkel, sfantao, fraggamuffin, rsmith. kkwli0 added a subscriber: cfe-commits. This patch is to add parsing and sema support for thread_limit clause. http://reviews.llvm.org/D15029 Files: include/clang/AST/OpenMPClause.h include/clang/AST/RecursiveASTVisitor.h include/clang/Basic/OpenMPKinds.def include/clang/Sema/Sema.h lib/AST/StmtPrinter.cpp lib/AST/StmtProfile.cpp lib/Basic/OpenMPKinds.cpp lib/CodeGen/CGStmtOpenMP.cpp lib/Parse/ParseOpenMP.cpp lib/Sema/SemaOpenMP.cpp lib/Sema/TreeTransform.h lib/Serialization/ASTReaderStmt.cpp lib/Serialization/ASTWriterStmt.cpp test/OpenMP/teams_ast_print.cpp test/OpenMP/teams_thread_limit_messages.cpp tools/libclang/CIndex.cpp Index: tools/libclang/CIndex.cpp === --- tools/libclang/CIndex.cpp +++ tools/libclang/CIndex.cpp @@ -2079,6 +2079,10 @@ Visitor->AddStmt(C->getNumTeams()); } +void OMPClauseEnqueue::VisitOMPThreadLimitClause(const OMPThreadLimitClause *C) { + Visitor->AddStmt(C->getThreadLimit()); +} + template void OMPClauseEnqueue::VisitOMPClauseList(T *Node) { for (const auto *I : Node->varlists()) { Index: test/OpenMP/teams_thread_limit_messages.cpp === --- /dev/null +++ test/OpenMP/teams_thread_limit_messages.cpp @@ -0,0 +1,111 @@ +// RUN: %clang_cc1 -verify -fopenmp -std=c++11 -ferror-limit 100 -o - %s + +void foo() { +} + +bool foobool(int argc) { + return argc; +} + +struct S1; // expected-note 2 {{declared here}} + +template // expected-note {{declared here}} +T tmain(T argc) { + char **a; +#pragma omp target +#pragma omp teams thread_limit(C) + foo(); +#pragma omp target +#pragma omp teams thread_limit(T) // expected-error {{'T' does not refer to a value}} + foo(); +#pragma omp target +#pragma omp teams thread_limit // expected-error {{expected '(' after 'thread_limit'}} + foo(); +#pragma omp target +#pragma omp teams thread_limit( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + foo(); +#pragma omp target +#pragma omp teams thread_limit() // expected-error {{expected expression}} + foo(); +#pragma omp target +#pragma omp teams thread_limit(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} + foo(); +#pragma omp target +#pragma omp teams thread_limit(argc)) // expected-warning {{extra tokens at the end of '#pragma omp teams' are ignored}} + foo(); +#pragma omp target +#pragma omp teams thread_limit(argc > 0 ? a[1] : a[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}} + foo(); +#pragma omp target +#pragma omp teams thread_limit(argc + argc) + foo(); +#pragma omp target +#pragma omp teams thread_limit(argc), thread_limit (argc+1) // expected-error {{directive '#pragma omp teams' cannot contain more than one 'thread_limit' clause}} + foo(); +#pragma omp target +#pragma omp teams thread_limit(S1) // expected-error {{'S1' does not refer to a value}} + foo(); +#pragma omp target +#pragma omp teams thread_limit(-2) // expected-error {{argument to 'thread_limit' clause must be a positive integer value}} + foo(); +#pragma omp target +#pragma omp teams thread_limit(-10u) + foo(); +#pragma omp target +#pragma omp teams thread_limit(3.14) // expected-error 2 {{expression must have integral or unscoped enumeration type, not 'double'}} + foo(); + + return 0; +} + +int main(int argc, char **argv) { +#pragma omp target +#pragma omp teams thread_limit // expected-error {{expected '(' after 'thread_limit'}} + foo(); + +#pragma omp target +#pragma omp teams thread_limit ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + foo(); + +#pragma omp target +#pragma omp teams thread_limit () // expected-error {{expected expression}} + foo(); + +#pragma omp target +#pragma omp teams thread_limit (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} + foo(); + +#pragma omp target +#pragma omp teams thread_limit (argc)) // expected-warning {{extra tokens at the end of '#pragma omp teams' are ignored}} + foo(); + +#pragma omp target +#pragma omp teams thread_limit (argc > 0 ? argv[1] : argv[2]) // expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}} + foo(); + +#pragma omp target +#pragma omp teams thread_limit (argc + argc) + foo(); + +#pragma omp target +#pragma omp teams thread_limit (argc), thread_limit (argc+1) // expected-error {{directive '#pragma omp teams' cannot contain more than one 'thread_limit' clause}} + foo(); + +#pragma omp target +#pragma omp teams thread_limit (S1) // expected-error {{'S1' does not refer to a value}} + foo(); + +#pragma omp target +#pragma omp teams thread_limit (-2) // expected-error {{argument to 'thread_limit' clause must be
Re: [PATCH] D15029: [OpenMP] Parsing and sema support for thread_limit clause
kkwli0 added inline comments. Comment at: lib/Sema/SemaOpenMP.cpp:5220-5242 @@ -5216,2 +5219,25 @@ +static bool IsNonNegativeIntegerValue(Expr *&ValExpr, Sema &SemaRef, + OpenMPClauseKind CKind) { + if (!ValExpr->isTypeDependent() && !ValExpr->isValueDependent() && + !ValExpr->isInstantiationDependent()) { +SourceLocation Loc = ValExpr->getExprLoc(); +ExprResult Value = +SemaRef.PerformOpenMPImplicitIntegerConversion(Loc, ValExpr); +if (Value.isInvalid()) + return false; + +ValExpr = Value.get(); +// The expression must evaluate to a non-negative integer value. +llvm::APSInt Result; +if (ValExpr->isIntegerConstantExpr(Result, SemaRef.Context) && +Result.isSigned() && !Result.isStrictlyPositive()) { + SemaRef.Diag(Loc, diag::err_omp_negative_expression_in_clause) + << getOpenMPClauseName(CKind) << ValExpr->getSourceRange(); + return false; +} + } + return true; +} + OMPClause *Sema::ActOnOpenMPNumThreadsClause(Expr *NumThreads, ABataev wrote: > Use Sema::VerifyPositiveIntegerConstantInClause() instead. num_teams/thread_limit/num_threads is not required to be a constant. Using Sema::VerifyPositiveIntegerConstantInClause() will impose a stricter constraint. http://reviews.llvm.org/D15029 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D15029: [OpenMP] Parsing and sema support for thread_limit clause
kkwli0 closed this revision. kkwli0 added a comment. Committed revision 254207. http://reviews.llvm.org/D15029 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r254207 - [OpenMP] Parsing and sema support for thread_limit clause.
Author: kli Date: Fri Nov 27 12:47:36 2015 New Revision: 254207 URL: http://llvm.org/viewvc/llvm-project?rev=254207&view=rev Log: [OpenMP] Parsing and sema support for thread_limit clause. http://reviews.llvm.org/D15029 Added: cfe/trunk/test/OpenMP/teams_thread_limit_messages.cpp Modified: cfe/trunk/include/clang/AST/OpenMPClause.h cfe/trunk/include/clang/AST/RecursiveASTVisitor.h cfe/trunk/include/clang/Basic/OpenMPKinds.def cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/lib/AST/StmtPrinter.cpp cfe/trunk/lib/AST/StmtProfile.cpp cfe/trunk/lib/Basic/OpenMPKinds.cpp cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp cfe/trunk/lib/Parse/ParseOpenMP.cpp cfe/trunk/lib/Sema/SemaOpenMP.cpp cfe/trunk/lib/Sema/TreeTransform.h cfe/trunk/lib/Serialization/ASTReaderStmt.cpp cfe/trunk/lib/Serialization/ASTWriterStmt.cpp cfe/trunk/test/OpenMP/teams_ast_print.cpp cfe/trunk/tools/libclang/CIndex.cpp Modified: cfe/trunk/include/clang/AST/OpenMPClause.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/OpenMPClause.h?rev=254207&r1=254206&r2=254207&view=diff == --- cfe/trunk/include/clang/AST/OpenMPClause.h (original) +++ cfe/trunk/include/clang/AST/OpenMPClause.h Fri Nov 27 12:47:36 2015 @@ -2783,6 +2783,61 @@ public: child_range children() { return child_range(&NumTeams, &NumTeams + 1); } }; +/// \brief This represents 'thread_limit' clause in the '#pragma omp ...' +/// directive. +/// +/// \code +/// #pragma omp teams thread_limit(n) +/// \endcode +/// In this example directive '#pragma omp teams' has clause 'thread_limit' +/// with single expression 'n'. +/// +class OMPThreadLimitClause : public OMPClause { + friend class OMPClauseReader; + /// \brief Location of '('. + SourceLocation LParenLoc; + /// \brief ThreadLimit number. + Stmt *ThreadLimit; + /// \brief Set the ThreadLimit number. + /// + /// \param E ThreadLimit number. + /// + void setThreadLimit(Expr *E) { ThreadLimit = E; } + +public: + /// \brief Build 'thread_limit' clause. + /// + /// \param E Expression associated with this clause. + /// \param StartLoc Starting location of the clause. + /// \param LParenLoc Location of '('. + /// \param EndLoc Ending location of the clause. + /// + OMPThreadLimitClause(Expr *E, SourceLocation StartLoc, + SourceLocation LParenLoc, SourceLocation EndLoc) + : OMPClause(OMPC_thread_limit, StartLoc, EndLoc), LParenLoc(LParenLoc), +ThreadLimit(E) {} + + /// \brief Build an empty clause. + /// + OMPThreadLimitClause() + : OMPClause(OMPC_thread_limit, SourceLocation(), SourceLocation()), +LParenLoc(SourceLocation()), ThreadLimit(nullptr) {} + /// \brief Sets the location of '('. + void setLParenLoc(SourceLocation Loc) { LParenLoc = Loc; } + /// \brief Returns the location of '('. + SourceLocation getLParenLoc() const { return LParenLoc; } + /// \brief Return ThreadLimit number. + Expr *getThreadLimit() { return cast(ThreadLimit); } + /// \brief Return ThreadLimit number. + Expr *getThreadLimit() const { return cast(ThreadLimit); } + + static bool classof(const OMPClause *T) { +return T->getClauseKind() == OMPC_thread_limit; + } + + child_range children() { return child_range(&ThreadLimit, &ThreadLimit + 1); } +}; + } // end namespace clang #endif // LLVM_CLANG_AST_OPENMPCLAUSE_H Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=254207&r1=254206&r2=254207&view=diff == --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original) +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Fri Nov 27 12:47:36 2015 @@ -2728,6 +2728,13 @@ bool RecursiveASTVisitor::Visit return true; } +template +bool RecursiveASTVisitor::VisitOMPThreadLimitClause( +OMPThreadLimitClause *C) { + TRY_TO(TraverseStmt(C->getThreadLimit())); + return true; +} + // FIXME: look at the following tricky-seeming exprs to see if we // need to recurse on anything. These are ones that have methods // returning decls or qualtypes or nestednamespecifier -- though I'm Modified: cfe/trunk/include/clang/Basic/OpenMPKinds.def URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/OpenMPKinds.def?rev=254207&r1=254206&r2=254207&view=diff == --- cfe/trunk/include/clang/Basic/OpenMPKinds.def (original) +++ cfe/trunk/include/clang/Basic/OpenMPKinds.def Fri Nov 27 12:47:36 2015 @@ -151,6 +151,7 @@ OPENMP_CLAUSE(threads, OMPThreadsClause) OPENMP_CLAUSE(simd, OMPSIMDClause) OPENMP_CLAUSE(map, OMPMapClause) OPENMP_CLAUSE(num_teams, OMPNumTeamsClause) +OPENMP_CLAUSE(thread_limit, OMPThreadLimitClause) // Clauses allowed for OpenMP directive 'paral
Re: [PATCH] D15125: [OPENMP] 'omp distribute' directive basic support.
kkwli0 added inline comments. Comment at: include/clang/AST/OpenMPClause.h:708 @@ -707,3 +707,3 @@ public: - /// \brief Build 'schedule' clause with schedule kind \a Kind and chunk size - /// expression \a ChunkSize. + /// \brief Build 'dist_schedule' clause with schedule kind \a Kind and chunk + /// size expression \a ChunkSize. Is it 'schedule'? Comment at: include/clang/AST/OpenMPClause.h:835 @@ +834,3 @@ +public: + /// \brief Build 'schedule' clause with schedule kind \a Kind and chunk size + /// expression \a ChunkSize. 'dist_schedule' Comment at: lib/Parse/ParseOpenMP.cpp:670 @@ -666,1 +669,3 @@ DelimLoc = ConsumeAnyToken(); + } else if (Kind == OMPC_dist_schedule) { +Arg = getOpenMPSimpleClauseType( Can we merge it with the OMPC_schedule block? The code is similar. Comment at: lib/Sema/SemaOpenMP.cpp:5780 @@ +5779,3 @@ + if (ChunkSize) { +if (!ChunkSize->isValueDependent() && !ChunkSize->isTypeDependent() && +!ChunkSize->isInstantiationDependent() && Is the IsNotNegativeIntegerValue useful in this case? Comment at: tools/libclang/CIndex.cpp:4489 @@ -4477,1 +4488,3 @@ + case CXCursor_OMPDistributeDirective: +return cxstring::createRef("OMPForDirective"); case CXCursor_OverloadCandidate: "OMPDistributeDirective" Repository: rL LLVM http://reviews.llvm.org/D15125 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang][Frontend] Implement printing defined macros via -dM (PR #87627)
kkwli wrote: @kparzysz Is it supposed to also print the predefined macros? Or only the user-defined macros? https://github.com/llvm/llvm-project/pull/87627 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [flang] Add -rtlib flag (PR #99058)
kkwli wrote: The linker-flags test fails on AIX too. https://github.com/llvm/llvm-project/pull/99058 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [lld] [flang] Generate main only when a Fortran program statement is present (PR #89938)
https://github.com/kkwli edited https://github.com/llvm/llvm-project/pull/89938 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [lld] [flang] Generate main only when a Fortran program statement is present (PR #89938)
https://github.com/kkwli approved this pull request. LG https://github.com/llvm/llvm-project/pull/89938 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [lld] [flang] Generate main only when a Fortran program statement is present (PR #89938)
@@ -24,6 +24,7 @@ add_flang_library(FIRBuilder Runtime/Inquiry.cpp Runtime/Intrinsics.cpp Runtime/Numeric.cpp + Runtime/Main.cpp kkwli wrote: I think this list is in alphabetical order? https://github.com/llvm/llvm-project/pull/89938 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [lld] [flang] Generate main only when a Fortran program statement is present (PR #89938)
kkwli wrote: This change will also break backward compatibility that the old object file that contain `main` can no longer use the new compiler to link with other objects. I think we can put a warning in the release note or something like that to warn users. https://github.com/llvm/llvm-project/pull/89938 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[clang] [flang] [Flang] Re-enable -print-resource-dir compiler option (PR #96799)
https://github.com/kkwli approved this pull request. LG. Thanks. https://github.com/llvm/llvm-project/pull/96799 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits