diff options
| author | Kelvin Li <kkwli0@gmail.com> | 2016-12-29 22:16:30 +0000 |
|---|---|---|
| committer | Kelvin Li <kkwli0@gmail.com> | 2016-12-29 22:16:30 +0000 |
| commit | 80e8f562846e9d2b7c73f0feadb1c160f5e59a51 (patch) | |
| tree | a8779e799045b14b5741ff4a47919c1ec821e850 /clang/lib | |
| parent | e0bd37e78fb4a6e80e6f43c2b959b8aeb9ee6303 (diff) | |
| download | bcm5719-llvm-80e8f562846e9d2b7c73f0feadb1c160f5e59a51.tar.gz bcm5719-llvm-80e8f562846e9d2b7c73f0feadb1c160f5e59a51.zip | |
[OpenMP] Sema and parsing for 'target teams distribute parallel for’ pragma
This patch is to implement sema and parsing for 'target teams distribute parallel for’ pragma.
Differential Revision: https://reviews.llvm.org/D28160
llvm-svn: 290725
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/StmtOpenMP.cpp | 61 | ||||
| -rw-r--r-- | clang/lib/AST/StmtPrinter.cpp | 6 | ||||
| -rw-r--r-- | clang/lib/AST/StmtProfile.cpp | 5 | ||||
| -rw-r--r-- | clang/lib/Basic/OpenMPKinds.cpp | 31 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGStmtOpenMP.cpp | 10 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 2 | ||||
| -rw-r--r-- | clang/lib/Parse/ParseOpenMP.cpp | 16 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 63 | ||||
| -rw-r--r-- | clang/lib/Sema/TreeTransform.h | 13 | ||||
| -rw-r--r-- | clang/lib/Serialization/ASTReaderStmt.cpp | 13 | ||||
| -rw-r--r-- | clang/lib/Serialization/ASTWriterStmt.cpp | 6 | ||||
| -rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExprEngine.cpp | 1 |
13 files changed, 215 insertions, 16 deletions
diff --git a/clang/lib/AST/StmtOpenMP.cpp b/clang/lib/AST/StmtOpenMP.cpp index 81c1d2c138a..0a90740162b 100644 --- a/clang/lib/AST/StmtOpenMP.cpp +++ b/clang/lib/AST/StmtOpenMP.cpp @@ -1598,3 +1598,64 @@ OMPTargetTeamsDistributeDirective::CreateEmpty(const ASTContext &C, numLoopChildren(CollapsedNum, OMPD_target_teams_distribute)); return new (Mem) OMPTargetTeamsDistributeDirective(CollapsedNum, NumClauses); } + +OMPTargetTeamsDistributeParallelForDirective * +OMPTargetTeamsDistributeParallelForDirective::Create( + const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc, + unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt, + const HelperExprs &Exprs) { + auto Size = + llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective), + alignof(OMPClause *)); + void *Mem = C.Allocate( + Size + sizeof(OMPClause *) * Clauses.size() + + sizeof(Stmt *) * + numLoopChildren(CollapsedNum, + OMPD_target_teams_distribute_parallel_for)); + OMPTargetTeamsDistributeParallelForDirective *Dir = + new (Mem) OMPTargetTeamsDistributeParallelForDirective( + StartLoc, EndLoc, CollapsedNum, Clauses.size()); + Dir->setClauses(Clauses); + Dir->setAssociatedStmt(AssociatedStmt); + Dir->setIterationVariable(Exprs.IterationVarRef); + Dir->setLastIteration(Exprs.LastIteration); + Dir->setCalcLastIteration(Exprs.CalcLastIteration); + Dir->setPreCond(Exprs.PreCond); + Dir->setCond(Exprs.Cond); + Dir->setInit(Exprs.Init); + Dir->setInc(Exprs.Inc); + Dir->setIsLastIterVariable(Exprs.IL); + Dir->setLowerBoundVariable(Exprs.LB); + Dir->setUpperBoundVariable(Exprs.UB); + Dir->setStrideVariable(Exprs.ST); + Dir->setEnsureUpperBound(Exprs.EUB); + Dir->setNextLowerBound(Exprs.NLB); + Dir->setNextUpperBound(Exprs.NUB); + Dir->setNumIterations(Exprs.NumIterations); + Dir->setPrevLowerBoundVariable(Exprs.PrevLB); + Dir->setPrevUpperBoundVariable(Exprs.PrevUB); + Dir->setCounters(Exprs.Counters); + Dir->setPrivateCounters(Exprs.PrivateCounters); + Dir->setInits(Exprs.Inits); + Dir->setUpdates(Exprs.Updates); + Dir->setFinals(Exprs.Finals); + Dir->setPreInits(Exprs.PreInits); + return Dir; +} + +OMPTargetTeamsDistributeParallelForDirective * +OMPTargetTeamsDistributeParallelForDirective::CreateEmpty(const ASTContext &C, + unsigned NumClauses, + unsigned CollapsedNum, + EmptyShell) { + auto Size = + llvm::alignTo(sizeof(OMPTargetTeamsDistributeParallelForDirective), + alignof(OMPClause *)); + void *Mem = C.Allocate( + Size + sizeof(OMPClause *) * NumClauses + + sizeof(Stmt *) * + numLoopChildren(CollapsedNum, + OMPD_target_teams_distribute_parallel_for)); + return new (Mem) + OMPTargetTeamsDistributeParallelForDirective(CollapsedNum, NumClauses); +} diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index fb7cd7f0ee0..a8f493dca07 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -1238,6 +1238,12 @@ void StmtPrinter::VisitOMPTargetTeamsDistributeDirective( PrintOMPExecutableDirective(Node); } +void StmtPrinter::VisitOMPTargetTeamsDistributeParallelForDirective( + OMPTargetTeamsDistributeParallelForDirective *Node) { + Indent() << "#pragma omp target teams distribute parallel for "; + PrintOMPExecutableDirective(Node); +} + //===----------------------------------------------------------------------===// // Expr printing methods. //===----------------------------------------------------------------------===// diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index f6f4386e60b..dd59a9b96c9 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -758,6 +758,11 @@ void StmtProfiler::VisitOMPTargetTeamsDistributeDirective( VisitOMPLoopDirective(S); } +void StmtProfiler::VisitOMPTargetTeamsDistributeParallelForDirective( + const OMPTargetTeamsDistributeParallelForDirective *S) { + VisitOMPLoopDirective(S); +} + void StmtProfiler::VisitExpr(const Expr *S) { VisitStmt(S); } diff --git a/clang/lib/Basic/OpenMPKinds.cpp b/clang/lib/Basic/OpenMPKinds.cpp index c99b3e8e75f..4675995ea72 100644 --- a/clang/lib/Basic/OpenMPKinds.cpp +++ b/clang/lib/Basic/OpenMPKinds.cpp @@ -680,6 +680,16 @@ bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind, break; } break; + case OMPD_target_teams_distribute_parallel_for: + switch (CKind) { +#define OPENMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_CLAUSE(Name) \ + case OMPC_##Name: \ + return true; +#include "clang/Basic/OpenMPKinds.def" + default: + break; + } + break; case OMPD_declare_target: case OMPD_end_declare_target: case OMPD_unknown: @@ -710,7 +720,8 @@ bool clang::isOpenMPLoopDirective(OpenMPDirectiveKind DKind) { DKind == OMPD_teams_distribute_simd || DKind == OMPD_teams_distribute_parallel_for_simd || DKind == OMPD_teams_distribute_parallel_for || - DKind == OMPD_target_teams_distribute; + DKind == OMPD_target_teams_distribute || + DKind == OMPD_target_teams_distribute_parallel_for; } bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) { @@ -723,7 +734,8 @@ bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) { DKind == OMPD_distribute_parallel_for_simd || DKind == OMPD_target_parallel_for_simd || DKind == OMPD_teams_distribute_parallel_for_simd || - DKind == OMPD_teams_distribute_parallel_for; + DKind == OMPD_teams_distribute_parallel_for || + DKind == OMPD_target_teams_distribute_parallel_for; // TODO add next directives. } @@ -739,7 +751,8 @@ bool clang::isOpenMPParallelDirective(OpenMPDirectiveKind DKind) { DKind == OMPD_distribute_parallel_for_simd || DKind == OMPD_target_parallel_for_simd || DKind == OMPD_teams_distribute_parallel_for || - DKind == OMPD_teams_distribute_parallel_for_simd; + DKind == OMPD_teams_distribute_parallel_for_simd || + DKind == OMPD_target_teams_distribute_parallel_for; // TODO add next directives. } @@ -747,7 +760,8 @@ bool clang::isOpenMPTargetExecutionDirective(OpenMPDirectiveKind DKind) { return DKind == OMPD_target || DKind == OMPD_target_parallel || DKind == OMPD_target_parallel_for || DKind == OMPD_target_parallel_for_simd || DKind == OMPD_target_simd || - DKind == OMPD_target_teams || DKind == OMPD_target_teams_distribute; + DKind == OMPD_target_teams || DKind == OMPD_target_teams_distribute || + DKind == OMPD_target_teams_distribute_parallel_for; } bool clang::isOpenMPTargetDataManagementDirective(OpenMPDirectiveKind DKind) { @@ -764,7 +778,8 @@ bool clang::isOpenMPNestingTeamsDirective(OpenMPDirectiveKind DKind) { bool clang::isOpenMPTeamsDirective(OpenMPDirectiveKind DKind) { return isOpenMPNestingTeamsDirective(DKind) || - DKind == OMPD_target_teams || DKind == OMPD_target_teams_distribute; + DKind == OMPD_target_teams || DKind == OMPD_target_teams_distribute || + DKind == OMPD_target_teams_distribute_parallel_for; } bool clang::isOpenMPSimdDirective(OpenMPDirectiveKind DKind) { @@ -789,7 +804,8 @@ bool clang::isOpenMPDistributeDirective(OpenMPDirectiveKind Kind) { Kind == OMPD_teams_distribute || Kind == OMPD_teams_distribute_simd || Kind == OMPD_teams_distribute_parallel_for_simd || Kind == OMPD_teams_distribute_parallel_for || - Kind == OMPD_target_teams_distribute; + Kind == OMPD_target_teams_distribute || + Kind == OMPD_target_teams_distribute_parallel_for; } bool clang::isOpenMPPrivate(OpenMPClauseKind Kind) { @@ -813,5 +829,6 @@ bool clang::isOpenMPLoopBoundSharingDirective(OpenMPDirectiveKind Kind) { Kind == OMPD_teams_distribute_simd || Kind == OMPD_teams_distribute_parallel_for_simd || Kind == OMPD_teams_distribute_parallel_for || - Kind == OMPD_target_teams_distribute; + Kind == OMPD_target_teams_distribute || + Kind == OMPD_target_teams_distribute_parallel_for; } diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 0100dc23fac..f2acb798b88 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -322,6 +322,10 @@ void CodeGenFunction::EmitStmt(const Stmt *S) { EmitOMPTargetTeamsDistributeDirective( cast<OMPTargetTeamsDistributeDirective>(*S)); break; + case Stmt::OMPTargetTeamsDistributeParallelForDirectiveClass: + EmitOMPTargetTeamsDistributeParallelForDirective( + cast<OMPTargetTeamsDistributeParallelForDirective>(*S)); + break; } } diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index 1572c537047..ba39e1fbd41 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -2022,6 +2022,16 @@ void CodeGenFunction::EmitOMPTargetTeamsDistributeDirective( }); } +void CodeGenFunction::EmitOMPTargetTeamsDistributeParallelForDirective( + const OMPTargetTeamsDistributeParallelForDirective &S) { + CGM.getOpenMPRuntime().emitInlinedDirective( + *this, OMPD_target_teams_distribute_parallel_for, + [&S](CodeGenFunction &CGF, PrePostActionTy &) { + CGF.EmitStmt( + cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt()); + }); +} + /// \brief Emit a helper variable and return corresponding lvalue. static LValue EmitOMPHelperVar(CodeGenFunction &CGF, const DeclRefExpr *Helper) { diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 55fc8227132..222d0e97968 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -2697,6 +2697,8 @@ public: void EmitOMPTargetTeamsDirective(const OMPTargetTeamsDirective &S); void EmitOMPTargetTeamsDistributeDirective( const OMPTargetTeamsDistributeDirective &S); + void EmitOMPTargetTeamsDistributeParallelForDirective( + const OMPTargetTeamsDistributeParallelForDirective &S); /// Emit outlined function for the target directive. static std::pair<llvm::Function * /*OutlinedFn*/, diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp index f7a6049d56e..061721dfb8d 100644 --- a/clang/lib/Parse/ParseOpenMP.cpp +++ b/clang/lib/Parse/ParseOpenMP.cpp @@ -40,7 +40,8 @@ enum OpenMPDirectiveKindEx { OMPD_target_exit, OMPD_update, OMPD_distribute_parallel, - OMPD_teams_distribute_parallel + OMPD_teams_distribute_parallel, + OMPD_target_teams_distribute_parallel }; class ThreadprivateListParserHelper final { @@ -116,7 +117,9 @@ static OpenMPDirectiveKind ParseOpenMPDirectiveKind(Parser &P) { { OMPD_teams_distribute_parallel, OMPD_for, OMPD_teams_distribute_parallel_for }, { OMPD_teams_distribute_parallel_for, OMPD_simd, OMPD_teams_distribute_parallel_for_simd }, { OMPD_target, OMPD_teams, OMPD_target_teams }, - { OMPD_target_teams, OMPD_distribute, OMPD_target_teams_distribute } + { OMPD_target_teams, OMPD_distribute, OMPD_target_teams_distribute }, + { OMPD_target_teams_distribute, OMPD_parallel, OMPD_target_teams_distribute_parallel }, + { OMPD_target_teams_distribute_parallel, OMPD_for, OMPD_target_teams_distribute_parallel_for } }; enum { CancellationPoint = 0, DeclareReduction = 1, TargetData = 2 }; auto Tok = P.getCurToken(); @@ -754,6 +757,7 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl( case OMPD_teams_distribute_parallel_for: case OMPD_target_teams: case OMPD_target_teams_distribute: + case OMPD_target_teams_distribute_parallel_for: Diag(Tok, diag::err_omp_unexpected_directive) << getOpenMPDirectiveName(DKind); break; @@ -790,8 +794,9 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirectiveWithExtDecl( /// 'target parallel for simd' | 'target simd' | /// 'teams distribute' | 'teams distribute simd' | /// 'teams distribute parallel for simd' | -/// 'teams distribute parallel for' | 'target teams' -/// 'target teams distribute' {clause} +/// 'teams distribute parallel for' | 'target teams' | +/// 'target teams distribute' | +/// 'target teams distribute parallel for' {clause} /// annot_pragma_openmp_end /// StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective( @@ -906,7 +911,8 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective( case OMPD_teams_distribute_parallel_for_simd: case OMPD_teams_distribute_parallel_for: case OMPD_target_teams: - case OMPD_target_teams_distribute: { + case OMPD_target_teams_distribute: + case OMPD_target_teams_distribute_parallel_for: { ConsumeToken(); // Parse directive name of the 'critical' directive if any. if (DKind == OMPD_critical) { diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index f8d1956a2d4..804aadc0ff7 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -1699,7 +1699,8 @@ void Sema::ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope) { case OMPD_teams_distribute_simd: case OMPD_teams_distribute_parallel_for_simd: case OMPD_teams_distribute_parallel_for: - case OMPD_target_teams_distribute: { + case OMPD_target_teams_distribute: + case OMPD_target_teams_distribute_parallel_for: { QualType KmpInt32Ty = Context.getIntTypeForBitwidth(32, 1); QualType KmpInt32PtrTy = Context.getPointerType(KmpInt32Ty).withConst().withRestrict(); @@ -2432,6 +2433,12 @@ StmtResult Sema::ActOnOpenMPExecutableDirective( ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA); AllowedNameModifiers.push_back(OMPD_target); break; + case OMPD_target_teams_distribute_parallel_for: + Res = ActOnOpenMPTargetTeamsDistributeParallelForDirective( + ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA); + AllowedNameModifiers.push_back(OMPD_target); + AllowedNameModifiers.push_back(OMPD_parallel); + break; case OMPD_declare_target: case OMPD_end_declare_target: case OMPD_threadprivate: @@ -6323,6 +6330,51 @@ StmtResult Sema::ActOnOpenMPTargetTeamsDistributeDirective( Context, StartLoc, EndLoc, NestedLoopCount, Clauses, AStmt, B); } +StmtResult Sema::ActOnOpenMPTargetTeamsDistributeParallelForDirective( + ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc, + SourceLocation EndLoc, + llvm::DenseMap<ValueDecl *, Expr *> &VarsWithImplicitDSA) { + if (!AStmt) + return StmtError(); + + CapturedStmt *CS = cast<CapturedStmt>(AStmt); + // 1.2.2 OpenMP Language Terminology + // Structured block - An executable statement with a single entry at the + // top and a single exit at the bottom. + // The point of exit cannot be a branch out of the structured block. + // longjmp() and throw() must not violate the entry/exit criteria. + CS->getCapturedDecl()->setNothrow(); + + OMPLoopDirective::HelperExprs B; + // In presence of clause 'collapse' with number of loops, it will + // define the nested loops number. + auto NestedLoopCount = CheckOpenMPLoop( + OMPD_target_teams_distribute_parallel_for, + getCollapseNumberExpr(Clauses), + nullptr /*ordered not a clause on distribute*/, AStmt, *this, *DSAStack, + VarsWithImplicitDSA, B); + if (NestedLoopCount == 0) + return StmtError(); + + assert((CurContext->isDependentContext() || B.builtAll()) && + "omp target teams distribute parallel for loop exprs were not built"); + + if (!CurContext->isDependentContext()) { + // Finalize the clauses that need pre-built expressions for CodeGen. + for (auto C : Clauses) { + if (auto *LC = dyn_cast<OMPLinearClause>(C)) + if (FinishOpenMPLinearClause(*LC, cast<DeclRefExpr>(B.IterationVarRef), + B.NumIterations, *this, CurScope, + DSAStack)) + return StmtError(); + } + } + + getCurFunction()->setHasBranchProtectedScope(); + return OMPTargetTeamsDistributeParallelForDirective::Create( + Context, StartLoc, EndLoc, NestedLoopCount, Clauses, AStmt, B); +} + OMPClause *Sema::ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr, SourceLocation StartLoc, SourceLocation LParenLoc, @@ -7344,7 +7396,8 @@ OMPClause *Sema::ActOnOpenMPPrivateClause(ArrayRef<Expr *> VarList, // attribute clause on the same construct if (CurrDir == OMPD_target || CurrDir == OMPD_target_parallel || CurrDir == OMPD_target_teams || - CurrDir == OMPD_target_teams_distribute) { + CurrDir == OMPD_target_teams_distribute || + CurrDir == OMPD_target_teams_distribute_parallel_for) { OpenMPClauseKind ConflictKind; if (DSAStack->checkMappableExprComponentListsForDecl( VD, /*CurrentRegionOnly=*/true, @@ -7603,7 +7656,8 @@ OMPClause *Sema::ActOnOpenMPFirstprivateClause(ArrayRef<Expr *> VarList, // attribute clause on the same construct if (CurrDir == OMPD_target || CurrDir == OMPD_target_parallel || CurrDir == OMPD_target_teams || - CurrDir == OMPD_target_teams_distribute) { + CurrDir == OMPD_target_teams_distribute || + CurrDir == OMPD_target_teams_distribute_parallel_for) { OpenMPClauseKind ConflictKind; if (DSAStack->checkMappableExprComponentListsForDecl( VD, /*CurrentRegionOnly=*/true, @@ -10120,7 +10174,8 @@ checkMappableExpressionList(Sema &SemaRef, DSAStackTy *DSAS, // A list item cannot appear in both a map clause and a data-sharing // attribute clause on the same construct if ((DKind == OMPD_target || DKind == OMPD_target_teams || - DKind == OMPD_target_teams) && VD) { + DKind == OMPD_target_teams_distribute || + DKind == OMPD_target_teams_distribute_parallel_for) && VD) { auto DVar = DSAS->getTopDSA(VD, false); if (isOpenMPPrivate(DVar.CKind)) { SemaRef.Diag(ELoc, diag::err_omp_variable_in_given_clause_and_dsa) diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 2a08fbe3717..3ab6019f0ec 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -7753,6 +7753,19 @@ StmtResult TreeTransform<Derived>::TransformOMPTargetTeamsDistributeDirective( return Res; } +template <typename Derived> +StmtResult +TreeTransform<Derived>::TransformOMPTargetTeamsDistributeParallelForDirective( + OMPTargetTeamsDistributeParallelForDirective *D) { + DeclarationNameInfo DirName; + getDerived().getSema().StartOpenMPDSABlock( + OMPD_target_teams_distribute_parallel_for, DirName, nullptr, + D->getLocStart()); + auto Res = getDerived().TransformOMPExecutableDirective(D); + getDerived().getSema().EndOpenMPDSABlock(Res.get()); + return Res; +} + //===----------------------------------------------------------------------===// // OpenMP clause transformation //===----------------------------------------------------------------------===// diff --git a/clang/lib/Serialization/ASTReaderStmt.cpp b/clang/lib/Serialization/ASTReaderStmt.cpp index 5b5f513bf3f..5607f764a9c 100644 --- a/clang/lib/Serialization/ASTReaderStmt.cpp +++ b/clang/lib/Serialization/ASTReaderStmt.cpp @@ -2855,6 +2855,11 @@ void ASTStmtReader::VisitOMPTargetTeamsDistributeDirective( VisitOMPLoopDirective(D); } +void ASTStmtReader::VisitOMPTargetTeamsDistributeParallelForDirective( + OMPTargetTeamsDistributeParallelForDirective *D) { + VisitOMPLoopDirective(D); +} + //===----------------------------------------------------------------------===// // ASTReader Implementation //===----------------------------------------------------------------------===// @@ -3625,6 +3630,14 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) { break; } + case STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE: { + auto NumClauses = Record[ASTStmtReader::NumStmtFields]; + auto CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1]; + S = OMPTargetTeamsDistributeParallelForDirective::CreateEmpty( + Context, NumClauses, CollapsedNum, Empty); + break; + } + case EXPR_CXX_OPERATOR_CALL: S = new (Context) CXXOperatorCallExpr(Context, Empty); break; diff --git a/clang/lib/Serialization/ASTWriterStmt.cpp b/clang/lib/Serialization/ASTWriterStmt.cpp index be420babc58..3993be146ed 100644 --- a/clang/lib/Serialization/ASTWriterStmt.cpp +++ b/clang/lib/Serialization/ASTWriterStmt.cpp @@ -2550,6 +2550,12 @@ void ASTStmtWriter::VisitOMPTargetTeamsDistributeDirective( Code = serialization::STMT_OMP_TARGET_TEAMS_DISTRIBUTE_DIRECTIVE; } +void ASTStmtWriter::VisitOMPTargetTeamsDistributeParallelForDirective( + OMPTargetTeamsDistributeParallelForDirective *D) { + VisitOMPLoopDirective(D); + Code = serialization::STMT_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_FOR_DIRECTIVE; +} + //===----------------------------------------------------------------------===// // ASTWriter Implementation //===----------------------------------------------------------------------===// diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp index 1e7ce8c7aa6..5b2119aeda2 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngine.cpp @@ -868,6 +868,7 @@ void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred, case Stmt::OMPTeamsDistributeParallelForDirectiveClass: case Stmt::OMPTargetTeamsDirectiveClass: case Stmt::OMPTargetTeamsDistributeDirectiveClass: + case Stmt::OMPTargetTeamsDistributeParallelForDirectiveClass: llvm_unreachable("Stmt should not be in analyzer evaluation loop"); case Stmt::ObjCSubscriptRefExprClass: |

