Revert r255001, "Add parse and sema for OpenMP distribute directive and all its clauses excluding dist_schedule."
It causes memory leak. Some tests in test/OpenMP would fail. llvm-svn: 255094
This commit is contained in:
parent
12f7929177
commit
2d5c6ddf74
|
@ -2264,11 +2264,7 @@ enum CXCursorKind {
|
|||
*/
|
||||
CXCursor_OMPTaskLoopSimdDirective = 259,
|
||||
|
||||
/** \brief OpenMP distribute directive.
|
||||
*/
|
||||
CXCursor_OMPDistributeDirective = 260,
|
||||
|
||||
CXCursor_LastStmt = CXCursor_OMPDistributeDirective,
|
||||
CXCursor_LastStmt = CXCursor_OMPTaskLoopSimdDirective,
|
||||
|
||||
/**
|
||||
* \brief Cursor that represents the translation unit itself.
|
||||
|
|
|
@ -2439,9 +2439,6 @@ DEF_TRAVERSE_STMT(OMPTaskLoopDirective,
|
|||
DEF_TRAVERSE_STMT(OMPTaskLoopSimdDirective,
|
||||
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
|
||||
|
||||
DEF_TRAVERSE_STMT(OMPDistributeDirective,
|
||||
{ TRY_TO(TraverseOMPExecutableDirective(S)); })
|
||||
|
||||
// OpenMP clauses.
|
||||
template <typename Derived>
|
||||
bool RecursiveASTVisitor<Derived>::TraverseOMPClause(OMPClause *C) {
|
||||
|
|
|
@ -424,50 +424,43 @@ protected:
|
|||
void setInc(Expr *Inc) { *std::next(child_begin(), IncOffset) = Inc; }
|
||||
void setIsLastIterVariable(Expr *IL) {
|
||||
assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
|
||||
isOpenMPTaskLoopDirective(getDirectiveKind()) ||
|
||||
isOpenMPDistributeDirective(getDirectiveKind())) &&
|
||||
isOpenMPTaskLoopDirective(getDirectiveKind())) &&
|
||||
"expected worksharing loop directive");
|
||||
*std::next(child_begin(), IsLastIterVariableOffset) = IL;
|
||||
}
|
||||
void setLowerBoundVariable(Expr *LB) {
|
||||
assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
|
||||
isOpenMPTaskLoopDirective(getDirectiveKind()) ||
|
||||
isOpenMPDistributeDirective(getDirectiveKind())) &&
|
||||
isOpenMPTaskLoopDirective(getDirectiveKind())) &&
|
||||
"expected worksharing loop directive");
|
||||
*std::next(child_begin(), LowerBoundVariableOffset) = LB;
|
||||
}
|
||||
void setUpperBoundVariable(Expr *UB) {
|
||||
assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
|
||||
isOpenMPTaskLoopDirective(getDirectiveKind()) ||
|
||||
isOpenMPDistributeDirective(getDirectiveKind())) &&
|
||||
isOpenMPTaskLoopDirective(getDirectiveKind())) &&
|
||||
"expected worksharing loop directive");
|
||||
*std::next(child_begin(), UpperBoundVariableOffset) = UB;
|
||||
}
|
||||
void setStrideVariable(Expr *ST) {
|
||||
assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
|
||||
isOpenMPTaskLoopDirective(getDirectiveKind()) ||
|
||||
isOpenMPDistributeDirective(getDirectiveKind())) &&
|
||||
isOpenMPTaskLoopDirective(getDirectiveKind())) &&
|
||||
"expected worksharing loop directive");
|
||||
*std::next(child_begin(), StrideVariableOffset) = ST;
|
||||
}
|
||||
void setEnsureUpperBound(Expr *EUB) {
|
||||
assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
|
||||
isOpenMPTaskLoopDirective(getDirectiveKind()) ||
|
||||
isOpenMPDistributeDirective(getDirectiveKind())) &&
|
||||
isOpenMPTaskLoopDirective(getDirectiveKind())) &&
|
||||
"expected worksharing loop directive");
|
||||
*std::next(child_begin(), EnsureUpperBoundOffset) = EUB;
|
||||
}
|
||||
void setNextLowerBound(Expr *NLB) {
|
||||
assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
|
||||
isOpenMPTaskLoopDirective(getDirectiveKind()) ||
|
||||
isOpenMPDistributeDirective(getDirectiveKind())) &&
|
||||
isOpenMPTaskLoopDirective(getDirectiveKind())) &&
|
||||
"expected worksharing loop directive");
|
||||
*std::next(child_begin(), NextLowerBoundOffset) = NLB;
|
||||
}
|
||||
void setNextUpperBound(Expr *NUB) {
|
||||
assert((isOpenMPWorksharingDirective(getDirectiveKind()) ||
|
||||
isOpenMPTaskLoopDirective(getDirectiveKind()) ||
|
||||
isOpenMPDistributeDirective(getDirectiveKind())) &&
|
||||
isOpenMPTaskLoopDirective(getDirectiveKind())) &&
|
||||
"expected worksharing loop directive");
|
||||
*std::next(child_begin(), NextUpperBoundOffset) = NUB;
|
||||
}
|
||||
|
@ -690,8 +683,7 @@ public:
|
|||
T->getStmtClass() == OMPParallelForDirectiveClass ||
|
||||
T->getStmtClass() == OMPParallelForSimdDirectiveClass ||
|
||||
T->getStmtClass() == OMPTaskLoopDirectiveClass ||
|
||||
T->getStmtClass() == OMPTaskLoopSimdDirectiveClass ||
|
||||
T->getStmtClass() == OMPDistributeDirectiveClass;
|
||||
T->getStmtClass() == OMPTaskLoopSimdDirectiveClass;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -2341,73 +2333,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
/// \brief This represents '#pragma omp distribute' directive.
|
||||
///
|
||||
/// \code
|
||||
/// #pragma omp distribute private(a,b)
|
||||
/// \endcode
|
||||
/// In this example directive '#pragma omp distribute' has clauses 'private'
|
||||
/// with the variables 'a' and 'b'
|
||||
///
|
||||
class OMPDistributeDirective : public OMPLoopDirective {
|
||||
friend class ASTStmtReader;
|
||||
|
||||
/// \brief Build directive with the given start and end location.
|
||||
///
|
||||
/// \param StartLoc Starting location of the directive kind.
|
||||
/// \param EndLoc Ending location of the directive.
|
||||
/// \param CollapsedNum Number of collapsed nested loops.
|
||||
/// \param NumClauses Number of clauses.
|
||||
///
|
||||
OMPDistributeDirective(SourceLocation StartLoc, SourceLocation EndLoc,
|
||||
unsigned CollapsedNum, unsigned NumClauses)
|
||||
: OMPLoopDirective(this, OMPDistributeDirectiveClass, OMPD_distribute,
|
||||
StartLoc, EndLoc, CollapsedNum, NumClauses)
|
||||
{}
|
||||
|
||||
/// \brief Build an empty directive.
|
||||
///
|
||||
/// \param CollapsedNum Number of collapsed nested loops.
|
||||
/// \param NumClauses Number of clauses.
|
||||
///
|
||||
explicit OMPDistributeDirective(unsigned CollapsedNum, unsigned NumClauses)
|
||||
: OMPLoopDirective(this, OMPDistributeDirectiveClass, OMPD_distribute,
|
||||
SourceLocation(), SourceLocation(), CollapsedNum,
|
||||
NumClauses)
|
||||
{}
|
||||
|
||||
public:
|
||||
/// \brief Creates directive with a list of \a Clauses.
|
||||
///
|
||||
/// \param C AST context.
|
||||
/// \param StartLoc Starting location of the directive kind.
|
||||
/// \param EndLoc Ending Location of the directive.
|
||||
/// \param CollapsedNum Number of collapsed loops.
|
||||
/// \param Clauses List of clauses.
|
||||
/// \param AssociatedStmt Statement, associated with the directive.
|
||||
/// \param Exprs Helper expressions for CodeGen.
|
||||
///
|
||||
static OMPDistributeDirective *
|
||||
Create(const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
|
||||
unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses,
|
||||
Stmt *AssociatedStmt, const HelperExprs &Exprs);
|
||||
|
||||
/// \brief Creates an empty directive with the place
|
||||
/// for \a NumClauses clauses.
|
||||
///
|
||||
/// \param C AST context.
|
||||
/// \param CollapsedNum Number of collapsed nested loops.
|
||||
/// \param NumClauses Number of clauses.
|
||||
///
|
||||
static OMPDistributeDirective *CreateEmpty(const ASTContext &C,
|
||||
unsigned NumClauses,
|
||||
unsigned CollapsedNum, EmptyShell);
|
||||
|
||||
static bool classof(const Stmt *T) {
|
||||
return T->getStmtClass() == OMPDistributeDirectiveClass;
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace clang
|
||||
|
||||
#endif
|
||||
|
|
|
@ -7802,8 +7802,7 @@ def err_omp_prohibited_region : Error<
|
|||
"region cannot be%select{| closely}0 nested inside '%1' region"
|
||||
"%select{|; perhaps you forget to enclose 'omp %3' directive into a parallel region?|"
|
||||
"; perhaps you forget to enclose 'omp %3' directive into a for or a parallel for region with 'ordered' clause?|"
|
||||
"; perhaps you forget to enclose 'omp %3' directive into a target region?|"
|
||||
"; perhaps you forget to enclose 'omp %3' directive into a teams region?}2">;
|
||||
"; perhaps you forget to enclose 'omp %3' directive into a target region?}2">;
|
||||
def err_omp_prohibited_region_simd : Error<
|
||||
"OpenMP constructs may not be nested inside a simd region">;
|
||||
def err_omp_prohibited_region_atomic : Error<
|
||||
|
@ -7922,12 +7921,6 @@ def err_omp_wrong_ordered_loop_count : Error<
|
|||
"the parameter of the 'ordered' clause must be greater than or equal to the parameter of the 'collapse' clause">;
|
||||
def note_collapse_loop_count : Note<
|
||||
"parameter of the 'collapse' clause">;
|
||||
def err_omp_firstprivate_distribute_private_teams : Error<
|
||||
"private variable in '#pragma omp teams' cannot be firstprivate in '#pragma omp distribute'">;
|
||||
def err_omp_firstprivate_and_lastprivate_in_distribute : Error<
|
||||
"lastprivate variable cannot be firstprivate in '#pragma omp distribute'">;
|
||||
def err_omp_firstprivate_distribute_in_teams_reduction : Error<
|
||||
"reduction variable in '#pragma omp teams' cannot be firstprivate in '#pragma omp distribute'">;
|
||||
def err_omp_grainsize_num_tasks_mutually_exclusive : Error<
|
||||
"'%0' and '%1' clause are mutually exclusive and may not appear on the same directive">;
|
||||
def note_omp_previous_grainsize_num_tasks : Note<
|
||||
|
|
|
@ -75,9 +75,6 @@
|
|||
#ifndef OPENMP_TASKLOOP_SIMD_CLAUSE
|
||||
# define OPENMP_TASKLOOP_SIMD_CLAUSE(Name)
|
||||
#endif
|
||||
#ifndef OPENMP_DISTRIBUTE_CLAUSE
|
||||
#define OPENMP_DISTRIBUTE_CLAUSE(Name)
|
||||
#endif
|
||||
#ifndef OPENMP_DEFAULT_KIND
|
||||
# define OPENMP_DEFAULT_KIND(Name)
|
||||
#endif
|
||||
|
@ -126,7 +123,6 @@ OPENMP_DIRECTIVE_EXT(for_simd, "for simd")
|
|||
OPENMP_DIRECTIVE_EXT(cancellation_point, "cancellation point")
|
||||
OPENMP_DIRECTIVE(taskloop)
|
||||
OPENMP_DIRECTIVE_EXT(taskloop_simd, "taskloop simd")
|
||||
OPENMP_DIRECTIVE(distribute)
|
||||
|
||||
// OpenMP clauses.
|
||||
OPENMP_CLAUSE(if, OMPIfClause)
|
||||
|
@ -393,12 +389,6 @@ OPENMP_TASKLOOP_SIMD_CLAUSE(grainsize)
|
|||
OPENMP_TASKLOOP_SIMD_CLAUSE(nogroup)
|
||||
OPENMP_TASKLOOP_SIMD_CLAUSE(num_tasks)
|
||||
|
||||
// Clauses allowed for OpenMP directive 'distribute'
|
||||
OPENMP_DISTRIBUTE_CLAUSE(private)
|
||||
OPENMP_DISTRIBUTE_CLAUSE(firstprivate)
|
||||
OPENMP_DISTRIBUTE_CLAUSE(lastprivate)
|
||||
OPENMP_DISTRIBUTE_CLAUSE(collapse)
|
||||
|
||||
#undef OPENMP_TASKLOOP_SIMD_CLAUSE
|
||||
#undef OPENMP_TASKLOOP_CLAUSE
|
||||
#undef OPENMP_LINEAR_KIND
|
||||
|
@ -426,4 +416,3 @@ OPENMP_DISTRIBUTE_CLAUSE(collapse)
|
|||
#undef OPENMP_FOR_CLAUSE
|
||||
#undef OPENMP_FOR_SIMD_CLAUSE
|
||||
#undef OPENMP_MAP_KIND
|
||||
#undef OPENMP_DISTRIBUTE_CLAUSE
|
||||
|
|
|
@ -141,13 +141,6 @@ bool isOpenMPTeamsDirective(OpenMPDirectiveKind DKind);
|
|||
/// otherwise - false.
|
||||
bool isOpenMPSimdDirective(OpenMPDirectiveKind DKind);
|
||||
|
||||
/// \brief Checks if the specified directive is a distribute directive.
|
||||
/// \param DKind Specified directive.
|
||||
/// \return true - the directive is a distribute-directive like 'omp
|
||||
/// distribute',
|
||||
/// otherwise - false.
|
||||
bool isOpenMPDistributeDirective(OpenMPDirectiveKind DKind);
|
||||
|
||||
/// \brief Checks if the specified clause is one of private clauses like
|
||||
/// 'private', 'firstprivate', 'reduction' etc..
|
||||
/// \param Kind Clause kind.
|
||||
|
|
|
@ -221,4 +221,4 @@ def OMPCancellationPointDirective : DStmt<OMPExecutableDirective>;
|
|||
def OMPCancelDirective : DStmt<OMPExecutableDirective>;
|
||||
def OMPTaskLoopDirective : DStmt<OMPLoopDirective>;
|
||||
def OMPTaskLoopSimdDirective : DStmt<OMPLoopDirective>;
|
||||
def OMPDistributeDirective : DStmt<OMPLoopDirective>;
|
||||
|
||||
|
|
|
@ -7961,12 +7961,6 @@ public:
|
|||
ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
|
||||
SourceLocation EndLoc,
|
||||
llvm::DenseMap<VarDecl *, Expr *> &VarsWithImplicitDSA);
|
||||
/// \brief Called on well-formed '\#pragma omp distribute' after parsing
|
||||
/// of the associated statement.
|
||||
StmtResult ActOnOpenMPDistributeDirective(
|
||||
ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
|
||||
SourceLocation EndLoc,
|
||||
llvm::DenseMap<VarDecl *, Expr *> &VarsWithImplicitDSA);
|
||||
|
||||
OMPClause *ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind,
|
||||
Expr *Expr,
|
||||
|
|
|
@ -1449,7 +1449,6 @@ namespace clang {
|
|||
STMT_OMP_CANCEL_DIRECTIVE,
|
||||
STMT_OMP_TASKLOOP_DIRECTIVE,
|
||||
STMT_OMP_TASKLOOP_SIMD_DIRECTIVE,
|
||||
STMT_OMP_DISTRIBUTE_DIRECTIVE,
|
||||
EXPR_OMP_ARRAY_SECTION,
|
||||
|
||||
// ARC
|
||||
|
|
|
@ -832,48 +832,3 @@ OMPTaskLoopSimdDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
|
|||
return new (Mem) OMPTaskLoopSimdDirective(CollapsedNum, NumClauses);
|
||||
}
|
||||
|
||||
OMPDistributeDirective *OMPDistributeDirective::Create(
|
||||
const ASTContext &C, SourceLocation StartLoc, SourceLocation EndLoc,
|
||||
unsigned CollapsedNum, ArrayRef<OMPClause *> Clauses, Stmt *AssociatedStmt,
|
||||
const HelperExprs &Exprs) {
|
||||
unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPDistributeDirective),
|
||||
llvm::alignOf<OMPClause *>());
|
||||
void *Mem = C.Allocate(Size + sizeof(OMPClause *) * Clauses.size() +
|
||||
sizeof(Stmt *) *
|
||||
numLoopChildren(CollapsedNum, OMPD_distribute));
|
||||
OMPDistributeDirective *Dir = new (Mem)
|
||||
OMPDistributeDirective(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->setCounters(Exprs.Counters);
|
||||
Dir->setPrivateCounters(Exprs.PrivateCounters);
|
||||
Dir->setInits(Exprs.Inits);
|
||||
Dir->setUpdates(Exprs.Updates);
|
||||
Dir->setFinals(Exprs.Finals);
|
||||
return Dir;
|
||||
}
|
||||
|
||||
OMPDistributeDirective *
|
||||
OMPDistributeDirective::CreateEmpty(const ASTContext &C, unsigned NumClauses,
|
||||
unsigned CollapsedNum, EmptyShell) {
|
||||
unsigned Size = llvm::RoundUpToAlignment(sizeof(OMPDistributeDirective),
|
||||
llvm::alignOf<OMPClause *>());
|
||||
void *Mem = C.Allocate(Size + sizeof(OMPClause *) * NumClauses +
|
||||
sizeof(Stmt *) *
|
||||
numLoopChildren(CollapsedNum, OMPD_distribute));
|
||||
return new (Mem) OMPDistributeDirective(CollapsedNum, NumClauses);
|
||||
}
|
||||
|
|
|
@ -1063,11 +1063,6 @@ void StmtPrinter::VisitOMPTaskLoopSimdDirective(
|
|||
PrintOMPExecutableDirective(Node);
|
||||
}
|
||||
|
||||
void StmtPrinter::VisitOMPDistributeDirective(OMPDistributeDirective *Node) {
|
||||
Indent() << "#pragma omp distribute ";
|
||||
PrintOMPExecutableDirective(Node);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Expr printing methods.
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -602,11 +602,6 @@ void StmtProfiler::VisitOMPTaskLoopSimdDirective(
|
|||
VisitOMPLoopDirective(S);
|
||||
}
|
||||
|
||||
void StmtProfiler::VisitOMPDistributeDirective(
|
||||
const OMPDistributeDirective *S) {
|
||||
VisitOMPLoopDirective(S);
|
||||
}
|
||||
|
||||
void StmtProfiler::VisitExpr(const Expr *S) {
|
||||
VisitStmt(S);
|
||||
}
|
||||
|
|
|
@ -433,16 +433,6 @@ bool clang::isAllowedClauseForDirective(OpenMPDirectiveKind DKind,
|
|||
#define OPENMP_TASKLOOP_SIMD_CLAUSE(Name) \
|
||||
case OMPC_##Name: \
|
||||
return true;
|
||||
#include "clang/Basic/OpenMPKinds.def"
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case OMPD_distribute:
|
||||
switch (CKind) {
|
||||
#define OPENMP_DISTRIBUTE_CLAUSE(Name) \
|
||||
case OMPC_##Name: \
|
||||
return true;
|
||||
#include "clang/Basic/OpenMPKinds.def"
|
||||
default:
|
||||
break;
|
||||
|
@ -467,8 +457,7 @@ bool clang::isOpenMPLoopDirective(OpenMPDirectiveKind DKind) {
|
|||
return DKind == OMPD_simd || DKind == OMPD_for || DKind == OMPD_for_simd ||
|
||||
DKind == OMPD_parallel_for || DKind == OMPD_parallel_for_simd ||
|
||||
DKind == OMPD_taskloop ||
|
||||
DKind == OMPD_taskloop_simd ||
|
||||
DKind == OMPD_distribute; // TODO add next directives.
|
||||
DKind == OMPD_taskloop_simd; // TODO add next directives.
|
||||
}
|
||||
|
||||
bool clang::isOpenMPWorksharingDirective(OpenMPDirectiveKind DKind) {
|
||||
|
@ -503,10 +492,6 @@ bool clang::isOpenMPSimdDirective(OpenMPDirectiveKind DKind) {
|
|||
DKind == OMPD_taskloop_simd; // TODO add next directives.
|
||||
}
|
||||
|
||||
bool clang::isOpenMPDistributeDirective(OpenMPDirectiveKind Kind) {
|
||||
return Kind == OMPD_distribute; // TODO add next directives.
|
||||
}
|
||||
|
||||
bool clang::isOpenMPPrivate(OpenMPClauseKind Kind) {
|
||||
return Kind == OMPC_private || Kind == OMPC_firstprivate ||
|
||||
Kind == OMPC_lastprivate || Kind == OMPC_linear ||
|
||||
|
|
|
@ -262,9 +262,6 @@ void CodeGenFunction::EmitStmt(const Stmt *S) {
|
|||
case Stmt::OMPTaskLoopSimdDirectiveClass:
|
||||
EmitOMPTaskLoopSimdDirective(cast<OMPTaskLoopSimdDirective>(*S));
|
||||
break;
|
||||
case Stmt::OMPDistributeDirectiveClass:
|
||||
EmitOMPDistributeDirective(cast<OMPDistributeDirective>(*S));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2045,11 +2045,6 @@ void CodeGenFunction::EmitOMPFlushDirective(const OMPFlushDirective &S) {
|
|||
}(), S.getLocStart());
|
||||
}
|
||||
|
||||
void CodeGenFunction::EmitOMPDistributeDirective(
|
||||
const OMPDistributeDirective &S) {
|
||||
llvm_unreachable("CodeGen for 'omp distribute' is not supported yet.");
|
||||
}
|
||||
|
||||
static llvm::Function *emitOutlinedOrderedFunction(CodeGenModule &CGM,
|
||||
const CapturedStmt *S) {
|
||||
CodeGenFunction CGF(CGM, /*suppressNewContext=*/true);
|
||||
|
|
|
@ -2339,7 +2339,6 @@ public:
|
|||
void EmitOMPCancelDirective(const OMPCancelDirective &S);
|
||||
void EmitOMPTaskLoopDirective(const OMPTaskLoopDirective &S);
|
||||
void EmitOMPTaskLoopSimdDirective(const OMPTaskLoopSimdDirective &S);
|
||||
void EmitOMPDistributeDirective(const OMPDistributeDirective &S);
|
||||
|
||||
/// \brief Emit inner loop of the worksharing/simd construct.
|
||||
///
|
||||
|
|
|
@ -140,7 +140,6 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirective() {
|
|||
case OMPD_target_data:
|
||||
case OMPD_taskloop:
|
||||
case OMPD_taskloop_simd:
|
||||
case OMPD_distribute:
|
||||
Diag(Tok, diag::err_omp_unexpected_directive)
|
||||
<< getOpenMPDirectiveName(DKind);
|
||||
break;
|
||||
|
@ -161,8 +160,7 @@ Parser::DeclGroupPtrTy Parser::ParseOpenMPDeclarativeDirective() {
|
|||
/// 'parallel for' | 'parallel sections' | 'task' | 'taskyield' |
|
||||
/// 'barrier' | 'taskwait' | 'flush' | 'ordered' | 'atomic' |
|
||||
/// 'for simd' | 'parallel for simd' | 'target' | 'target data' |
|
||||
/// 'taskgroup' | 'teams' | 'taskloop' | 'taskloop simd' {clause} |
|
||||
/// 'distribute'
|
||||
/// 'taskgroup' | 'teams' | 'taskloop' | 'taskloop simd' {clause}
|
||||
/// annot_pragma_openmp_end
|
||||
///
|
||||
StmtResult
|
||||
|
@ -239,8 +237,7 @@ Parser::ParseOpenMPDeclarativeOrExecutableDirective(bool StandAloneAllowed) {
|
|||
case OMPD_taskgroup:
|
||||
case OMPD_target_data:
|
||||
case OMPD_taskloop:
|
||||
case OMPD_taskloop_simd:
|
||||
case OMPD_distribute: {
|
||||
case OMPD_taskloop_simd: {
|
||||
ConsumeToken();
|
||||
// Parse directive name of the 'critical' directive if any.
|
||||
if (DKind == OMPD_critical) {
|
||||
|
|
|
@ -1568,14 +1568,6 @@ void Sema::ActOnOpenMPRegionStart(OpenMPDirectiveKind DKind, Scope *CurScope) {
|
|||
Params);
|
||||
break;
|
||||
}
|
||||
case OMPD_distribute: {
|
||||
Sema::CapturedParamNameType Params[] = {
|
||||
std::make_pair(StringRef(), QualType()) // __context with shared vars
|
||||
};
|
||||
ActOnCapturedRegionStart(DSAStack->getConstructLoc(), CurScope, CR_OpenMP,
|
||||
Params);
|
||||
break;
|
||||
}
|
||||
case OMPD_threadprivate:
|
||||
case OMPD_taskyield:
|
||||
case OMPD_barrier:
|
||||
|
@ -1660,7 +1652,6 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | parallel | cancel | ! |
|
||||
// | parallel | taskloop | * |
|
||||
// | parallel | taskloop simd | * |
|
||||
// | parallel | distribute | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | for | parallel | * |
|
||||
// | for | for | + |
|
||||
|
@ -1689,7 +1680,6 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | for | cancel | ! |
|
||||
// | for | taskloop | * |
|
||||
// | for | taskloop simd | * |
|
||||
// | for | distribute | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | master | parallel | * |
|
||||
// | master | for | + |
|
||||
|
@ -1718,7 +1708,6 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | master | cancel | |
|
||||
// | master | taskloop | * |
|
||||
// | master | taskloop simd | * |
|
||||
// | master | distribute | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | critical | parallel | * |
|
||||
// | critical | for | + |
|
||||
|
@ -1746,7 +1735,6 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | critical | cancel | |
|
||||
// | critical | taskloop | * |
|
||||
// | critical | taskloop simd | * |
|
||||
// | critical | distribute | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | simd | parallel | |
|
||||
// | simd | for | |
|
||||
|
@ -1775,7 +1763,6 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | simd | cancel | |
|
||||
// | simd | taskloop | |
|
||||
// | simd | taskloop simd | |
|
||||
// | simd | distribute | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | for simd | parallel | |
|
||||
// | for simd | for | |
|
||||
|
@ -1804,7 +1791,6 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | for simd | cancel | |
|
||||
// | for simd | taskloop | |
|
||||
// | for simd | taskloop simd | |
|
||||
// | for simd | distribute | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | parallel for simd| parallel | |
|
||||
// | parallel for simd| for | |
|
||||
|
@ -1833,7 +1819,6 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | parallel for simd| cancel | |
|
||||
// | parallel for simd| taskloop | |
|
||||
// | parallel for simd| taskloop simd | |
|
||||
// | parallel for simd| distribute | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | sections | parallel | * |
|
||||
// | sections | for | + |
|
||||
|
@ -1862,7 +1847,6 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | sections | cancel | ! |
|
||||
// | sections | taskloop | * |
|
||||
// | sections | taskloop simd | * |
|
||||
// | sections | distribute | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | section | parallel | * |
|
||||
// | section | for | + |
|
||||
|
@ -1891,7 +1875,6 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | section | cancel | ! |
|
||||
// | section | taskloop | * |
|
||||
// | section | taskloop simd | * |
|
||||
// | section | distribute | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | single | parallel | * |
|
||||
// | single | for | + |
|
||||
|
@ -1920,7 +1903,6 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | single | cancel | |
|
||||
// | single | taskloop | * |
|
||||
// | single | taskloop simd | * |
|
||||
// | single | distribute | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | parallel for | parallel | * |
|
||||
// | parallel for | for | + |
|
||||
|
@ -1949,7 +1931,6 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | parallel for | cancel | ! |
|
||||
// | parallel for | taskloop | * |
|
||||
// | parallel for | taskloop simd | * |
|
||||
// | parallel for | distribute | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | parallel sections| parallel | * |
|
||||
// | parallel sections| for | + |
|
||||
|
@ -1978,7 +1959,6 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | parallel sections| cancel | ! |
|
||||
// | parallel sections| taskloop | * |
|
||||
// | parallel sections| taskloop simd | * |
|
||||
// | parallel sections| distribute | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | task | parallel | * |
|
||||
// | task | for | + |
|
||||
|
@ -2007,7 +1987,6 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | task | cancel | ! |
|
||||
// | task | taskloop | * |
|
||||
// | task | taskloop simd | * |
|
||||
// | task | distribute | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | ordered | parallel | * |
|
||||
// | ordered | for | + |
|
||||
|
@ -2036,7 +2015,6 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | ordered | cancel | |
|
||||
// | ordered | taskloop | * |
|
||||
// | ordered | taskloop simd | * |
|
||||
// | ordered | distribute | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | atomic | parallel | |
|
||||
// | atomic | for | |
|
||||
|
@ -2065,7 +2043,6 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | atomic | cancel | |
|
||||
// | atomic | taskloop | |
|
||||
// | atomic | taskloop simd | |
|
||||
// | atomic | distribute | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | target | parallel | * |
|
||||
// | target | for | * |
|
||||
|
@ -2094,7 +2071,6 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | target | cancel | |
|
||||
// | target | taskloop | * |
|
||||
// | target | taskloop simd | * |
|
||||
// | target | distribute | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | teams | parallel | * |
|
||||
// | teams | for | + |
|
||||
|
@ -2123,7 +2099,6 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | teams | cancel | |
|
||||
// | teams | taskloop | + |
|
||||
// | teams | taskloop simd | + |
|
||||
// | teams | distribute | ! |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | taskloop | parallel | * |
|
||||
// | taskloop | for | + |
|
||||
|
@ -2151,7 +2126,6 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | | point | |
|
||||
// | taskloop | cancel | |
|
||||
// | taskloop | taskloop | * |
|
||||
// | taskloop | distribute | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | taskloop simd | parallel | |
|
||||
// | taskloop simd | for | |
|
||||
|
@ -2180,36 +2154,6 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// | taskloop simd | cancel | |
|
||||
// | taskloop simd | taskloop | |
|
||||
// | taskloop simd | taskloop simd | |
|
||||
// | taskloop simd | distribute | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
// | distribute | parallel | * |
|
||||
// | distribute | for | * |
|
||||
// | distribute | for simd | * |
|
||||
// | distribute | master | * |
|
||||
// | distribute | critical | * |
|
||||
// | distribute | simd | * |
|
||||
// | distribute | sections | * |
|
||||
// | distribute | section | * |
|
||||
// | distribute | single | * |
|
||||
// | distribute | parallel for | * |
|
||||
// | distribute |parallel for simd| * |
|
||||
// | distribute |parallel sections| * |
|
||||
// | distribute | task | * |
|
||||
// | distribute | taskyield | * |
|
||||
// | distribute | barrier | * |
|
||||
// | distribute | taskwait | * |
|
||||
// | distribute | taskgroup | * |
|
||||
// | distribute | flush | * |
|
||||
// | distribute | ordered | + |
|
||||
// | distribute | atomic | * |
|
||||
// | distribute | target | |
|
||||
// | distribute | teams | |
|
||||
// | distribute | cancellation | + |
|
||||
// | | point | |
|
||||
// | distribute | cancel | + |
|
||||
// | distribute | taskloop | * |
|
||||
// | distribute | taskloop simd | * |
|
||||
// | distribute | distribute | |
|
||||
// +------------------+-----------------+------------------------------------+
|
||||
if (Stack->getCurScope()) {
|
||||
auto ParentRegion = Stack->getParentDirective();
|
||||
|
@ -2219,8 +2163,7 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
NoRecommend,
|
||||
ShouldBeInParallelRegion,
|
||||
ShouldBeInOrderedRegion,
|
||||
ShouldBeInTargetRegion,
|
||||
ShouldBeInTeamsRegion
|
||||
ShouldBeInTargetRegion
|
||||
} Recommend = NoRecommend;
|
||||
if (isOpenMPSimdDirective(ParentRegion) && CurrentRegion != OMPD_ordered) {
|
||||
// OpenMP [2.16, Nesting of Regions]
|
||||
|
@ -2360,17 +2303,10 @@ static bool CheckNestingOfRegions(Sema &SemaRef, DSAStackTy *Stack,
|
|||
// distribute, parallel, parallel sections, parallel workshare, and the
|
||||
// parallel loop and parallel loop SIMD constructs are the only OpenMP
|
||||
// constructs that can be closely nested in the teams region.
|
||||
NestingProhibited = !isOpenMPParallelDirective(CurrentRegion) &&
|
||||
!isOpenMPDistributeDirective(CurrentRegion);
|
||||
// TODO: add distribute directive.
|
||||
NestingProhibited = !isOpenMPParallelDirective(CurrentRegion);
|
||||
Recommend = ShouldBeInParallelRegion;
|
||||
}
|
||||
if (!NestingProhibited && isOpenMPDistributeDirective(CurrentRegion)) {
|
||||
// OpenMP 4.5 [2.17 Nesting of Regions]
|
||||
// The region associated with the distribute construct must be strictly
|
||||
// nested inside a teams region
|
||||
NestingProhibited = !isOpenMPTeamsDirective(ParentRegion);
|
||||
Recommend = ShouldBeInTeamsRegion;
|
||||
}
|
||||
if (NestingProhibited) {
|
||||
SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region)
|
||||
<< CloseNesting << getOpenMPDirectiveName(ParentRegion) << Recommend
|
||||
|
@ -2638,10 +2574,6 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(
|
|||
EndLoc, VarsWithInheritedDSA);
|
||||
AllowedNameModifiers.push_back(OMPD_taskloop);
|
||||
break;
|
||||
case OMPD_distribute:
|
||||
Res = ActOnOpenMPDistributeDirective(ClausesWithImplicit, AStmt, StartLoc,
|
||||
EndLoc, VarsWithInheritedDSA);
|
||||
break;
|
||||
case OMPD_threadprivate:
|
||||
llvm_unreachable("OpenMP Directive is not allowed");
|
||||
case OMPD_unknown:
|
||||
|
@ -3470,8 +3402,7 @@ static bool CheckOpenMPIterationSpace(
|
|||
: OMPC_private;
|
||||
if (((isOpenMPSimdDirective(DKind) && DVar.CKind != OMPC_unknown &&
|
||||
DVar.CKind != OMPC_threadprivate && DVar.CKind != PredeterminedCKind) ||
|
||||
((isOpenMPWorksharingDirective(DKind) || DKind == OMPD_taskloop ||
|
||||
isOpenMPDistributeDirective(DKind)) &&
|
||||
((isOpenMPWorksharingDirective(DKind) || DKind == OMPD_taskloop) &&
|
||||
!isOpenMPSimdDirective(DKind) && DVar.CKind != OMPC_unknown &&
|
||||
DVar.CKind != OMPC_private && DVar.CKind != OMPC_lastprivate &&
|
||||
DVar.CKind != OMPC_threadprivate)) &&
|
||||
|
@ -3510,8 +3441,7 @@ static bool CheckOpenMPIterationSpace(
|
|||
ResultIterSpace.PreCond = ISC.BuildPreCond(DSA.getCurScope(), For->getCond());
|
||||
ResultIterSpace.NumIterations = ISC.BuildNumIterations(
|
||||
DSA.getCurScope(), (isOpenMPWorksharingDirective(DKind) ||
|
||||
isOpenMPTaskLoopDirective(DKind) ||
|
||||
isOpenMPDistributeDirective(DKind)));
|
||||
isOpenMPTaskLoopDirective(DKind)));
|
||||
ResultIterSpace.CounterVar = ISC.BuildCounterVar();
|
||||
ResultIterSpace.PrivateCounterVar = ISC.BuildPrivateCounterVar();
|
||||
ResultIterSpace.CounterInit = ISC.BuildCounterInit();
|
||||
|
@ -3819,8 +3749,7 @@ CheckOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr,
|
|||
QualType VType = LastIteration.get()->getType();
|
||||
// Build variables passed into runtime, nesessary for worksharing directives.
|
||||
ExprResult LB, UB, IL, ST, EUB;
|
||||
if (isOpenMPWorksharingDirective(DKind) || isOpenMPTaskLoopDirective(DKind) ||
|
||||
isOpenMPDistributeDirective(DKind)) {
|
||||
if (isOpenMPWorksharingDirective(DKind) || isOpenMPTaskLoopDirective(DKind)) {
|
||||
// Lower bound variable, initialized with zero.
|
||||
VarDecl *LBDecl = buildVarDecl(SemaRef, InitLoc, VType, ".omp.lb");
|
||||
LB = buildDeclRefExpr(SemaRef, LBDecl, VType, InitLoc);
|
||||
|
@ -3869,8 +3798,7 @@ CheckOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr,
|
|||
VarDecl *IVDecl = buildVarDecl(SemaRef, InitLoc, VType, ".omp.iv");
|
||||
IV = buildDeclRefExpr(SemaRef, IVDecl, VType, InitLoc);
|
||||
Expr *RHS = (isOpenMPWorksharingDirective(DKind) ||
|
||||
isOpenMPTaskLoopDirective(DKind) ||
|
||||
isOpenMPDistributeDirective(DKind))
|
||||
isOpenMPTaskLoopDirective(DKind))
|
||||
? LB.get()
|
||||
: SemaRef.ActOnIntegerConstant(SourceLocation(), 0).get();
|
||||
Init = SemaRef.BuildBinOp(CurScope, InitLoc, BO_Assign, IV.get(), RHS);
|
||||
|
@ -3880,8 +3808,7 @@ CheckOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr,
|
|||
// Loop condition (IV < NumIterations) or (IV <= UB) for worksharing loops.
|
||||
SourceLocation CondLoc;
|
||||
ExprResult Cond =
|
||||
(isOpenMPWorksharingDirective(DKind) ||
|
||||
isOpenMPTaskLoopDirective(DKind) || isOpenMPDistributeDirective(DKind))
|
||||
(isOpenMPWorksharingDirective(DKind) || isOpenMPTaskLoopDirective(DKind))
|
||||
? SemaRef.BuildBinOp(CurScope, CondLoc, BO_LE, IV.get(), UB.get())
|
||||
: SemaRef.BuildBinOp(CurScope, CondLoc, BO_LT, IV.get(),
|
||||
NumIterations.get());
|
||||
|
@ -3901,8 +3828,7 @@ CheckOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr,
|
|||
// Increments for worksharing loops (LB = LB + ST; UB = UB + ST).
|
||||
// Used for directives with static scheduling.
|
||||
ExprResult NextLB, NextUB;
|
||||
if (isOpenMPWorksharingDirective(DKind) || isOpenMPTaskLoopDirective(DKind) ||
|
||||
isOpenMPDistributeDirective(DKind)) {
|
||||
if (isOpenMPWorksharingDirective(DKind) || isOpenMPTaskLoopDirective(DKind)) {
|
||||
// LB + ST
|
||||
NextLB = SemaRef.BuildBinOp(CurScope, IncLoc, BO_Add, LB.get(), ST.get());
|
||||
if (!NextLB.isUsable())
|
||||
|
@ -5455,32 +5381,6 @@ StmtResult Sema::ActOnOpenMPTaskLoopSimdDirective(
|
|||
NestedLoopCount, Clauses, AStmt, B);
|
||||
}
|
||||
|
||||
StmtResult Sema::ActOnOpenMPDistributeDirective(
|
||||
ArrayRef<OMPClause *> Clauses, Stmt *AStmt, SourceLocation StartLoc,
|
||||
SourceLocation EndLoc,
|
||||
llvm::DenseMap<VarDecl *, Expr *> &VarsWithImplicitDSA) {
|
||||
if (!AStmt)
|
||||
return StmtError();
|
||||
|
||||
assert(isa<CapturedStmt>(AStmt) && "Captured statement expected");
|
||||
OMPLoopDirective::HelperExprs B;
|
||||
// In presence of clause 'collapse' with number of loops, it will
|
||||
// define the nested loops number.
|
||||
unsigned NestedLoopCount =
|
||||
CheckOpenMPLoop(OMPD_distribute, 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 for loop exprs were not built");
|
||||
|
||||
getCurFunction()->setHasBranchProtectedScope();
|
||||
return OMPDistributeDirective::Create(Context, StartLoc, EndLoc,
|
||||
NestedLoopCount, Clauses, AStmt, B);
|
||||
}
|
||||
|
||||
OMPClause *Sema::ActOnOpenMPSingleExprClause(OpenMPClauseKind Kind, Expr *Expr,
|
||||
SourceLocation StartLoc,
|
||||
SourceLocation LParenLoc,
|
||||
|
@ -6524,49 +6424,6 @@ OMPClause *Sema::ActOnOpenMPFirstprivateClause(ArrayRef<Expr *> VarList,
|
|||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// OpenMP 4.5 [2.15.3.4, Restrictions, p.3]
|
||||
// A list item that is private within a teams region must not appear in a
|
||||
// firstprivate clause on a distribute construct if any of the distribute
|
||||
// regions arising from the distribute construct ever bind to any of the
|
||||
// teams regions arising from the teams construct.
|
||||
// OpenMP 4.5 [2.15.3.4, Restrictions, p.3]
|
||||
// A list item that appears in a reduction clause of a teams construct
|
||||
// must not appear in a firstprivate clause on a distribute construct if
|
||||
// any of the distribute regions arising from the distribute construct
|
||||
// ever bind to any of the teams regions arising from the teams construct.
|
||||
// OpenMP 4.5 [2.10.8, Distribute Construct, p.3]
|
||||
// A list item may appear in a firstprivate or lastprivate clause but not
|
||||
// both.
|
||||
if (CurrDir == OMPD_distribute) {
|
||||
DVar = DSAStack->hasInnermostDSA(VD, MatchesAnyClause(OMPC_private),
|
||||
[](OpenMPDirectiveKind K) -> bool {
|
||||
return isOpenMPTeamsDirective(K);
|
||||
},
|
||||
false);
|
||||
if (DVar.CKind == OMPC_private && isOpenMPTeamsDirective(DVar.DKind)) {
|
||||
Diag(ELoc, diag::err_omp_firstprivate_distribute_private_teams);
|
||||
ReportOriginalDSA(*this, DSAStack, VD, DVar);
|
||||
continue;
|
||||
}
|
||||
DVar = DSAStack->hasInnermostDSA(VD, MatchesAnyClause(OMPC_reduction),
|
||||
[](OpenMPDirectiveKind K) -> bool {
|
||||
return isOpenMPTeamsDirective(K);
|
||||
},
|
||||
false);
|
||||
if (DVar.CKind == OMPC_reduction &&
|
||||
isOpenMPTeamsDirective(DVar.DKind)) {
|
||||
Diag(ELoc, diag::err_omp_firstprivate_distribute_in_teams_reduction);
|
||||
ReportOriginalDSA(*this, DSAStack, VD, DVar);
|
||||
continue;
|
||||
}
|
||||
DVar = DSAStack->getTopDSA(VD, false);
|
||||
if (DVar.CKind == OMPC_lastprivate) {
|
||||
Diag(ELoc, diag::err_omp_firstprivate_and_lastprivate_in_distribute);
|
||||
ReportOriginalDSA(*this, DSAStack, VD, DVar);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Variably modified types are not supported for tasks.
|
||||
|
@ -6763,18 +6620,6 @@ OMPClause *Sema::ActOnOpenMPLastprivateClause(ArrayRef<Expr *> VarList,
|
|||
if (AssignmentOp.isInvalid())
|
||||
continue;
|
||||
|
||||
// OpenMP 4.5 [2.10.8, Distribute Construct, p.3]
|
||||
// A list item may appear in a firstprivate or lastprivate clause but not
|
||||
// both.
|
||||
if (CurrDir == OMPD_distribute) {
|
||||
DSAStackTy::DSAVarData DVar = DSAStack->getTopDSA(VD, false);
|
||||
if (DVar.CKind == OMPC_firstprivate) {
|
||||
Diag(ELoc, diag::err_omp_firstprivate_and_lastprivate_in_distribute);
|
||||
ReportOriginalDSA(*this, DSAStack, VD, DVar);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (TopDVar.CKind != OMPC_firstprivate)
|
||||
DSAStack->addDSA(VD, DE, OMPC_lastprivate);
|
||||
Vars.push_back(DE);
|
||||
|
|
|
@ -7397,17 +7397,6 @@ StmtResult TreeTransform<Derived>::TransformOMPTaskLoopSimdDirective(
|
|||
return Res;
|
||||
}
|
||||
|
||||
template <typename Derived>
|
||||
StmtResult TreeTransform<Derived>::TransformOMPDistributeDirective(
|
||||
OMPDistributeDirective *D) {
|
||||
DeclarationNameInfo DirName;
|
||||
getDerived().getSema().StartOpenMPDSABlock(OMPD_distribute, DirName, nullptr,
|
||||
D->getLocStart());
|
||||
StmtResult Res = getDerived().TransformOMPExecutableDirective(D);
|
||||
getDerived().getSema().EndOpenMPDSABlock(Res.get());
|
||||
return Res;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// OpenMP clause transformation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -2449,10 +2449,6 @@ void ASTStmtReader::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
|
|||
VisitOMPLoopDirective(D);
|
||||
}
|
||||
|
||||
void ASTStmtReader::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ASTReader Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
@ -3091,14 +3087,6 @@ Stmt *ASTReader::ReadStmtFromStream(ModuleFile &F) {
|
|||
break;
|
||||
}
|
||||
|
||||
case STMT_OMP_DISTRIBUTE_DIRECTIVE: {
|
||||
unsigned NumClauses = Record[ASTStmtReader::NumStmtFields];
|
||||
unsigned CollapsedNum = Record[ASTStmtReader::NumStmtFields + 1];
|
||||
S = OMPDistributeDirective::CreateEmpty(Context, NumClauses, CollapsedNum,
|
||||
Empty);
|
||||
break;
|
||||
}
|
||||
|
||||
case EXPR_CXX_OPERATOR_CALL:
|
||||
S = new (Context) CXXOperatorCallExpr(Context, Empty);
|
||||
break;
|
||||
|
|
|
@ -2266,11 +2266,6 @@ void ASTStmtWriter::VisitOMPTaskLoopSimdDirective(OMPTaskLoopSimdDirective *D) {
|
|||
Code = serialization::STMT_OMP_TASKLOOP_SIMD_DIRECTIVE;
|
||||
}
|
||||
|
||||
void ASTStmtWriter::VisitOMPDistributeDirective(OMPDistributeDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
Code = serialization::STMT_OMP_DISTRIBUTE_DIRECTIVE;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// ASTWriter Implementation
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -831,7 +831,6 @@ void ExprEngine::Visit(const Stmt *S, ExplodedNode *Pred,
|
|||
case Stmt::OMPCancelDirectiveClass:
|
||||
case Stmt::OMPTaskLoopDirectiveClass:
|
||||
case Stmt::OMPTaskLoopSimdDirectiveClass:
|
||||
case Stmt::OMPDistributeDirectiveClass:
|
||||
llvm_unreachable("Stmt should not be in analyzer evaluation loop");
|
||||
|
||||
case Stmt::ObjCSubscriptRefExprClass:
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
// 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
|
||||
// expected-no-diagnostics
|
||||
|
||||
#ifndef HEADER
|
||||
#define HEADER
|
||||
|
||||
void foo() {}
|
||||
|
||||
template <class T, int N>
|
||||
T tmain(T argc) {
|
||||
T b = argc, c, d, e, f, g;
|
||||
static T a;
|
||||
// CHECK: static T a;
|
||||
#pragma omp distribute
|
||||
// CHECK-NEXT: #pragma omp distribute
|
||||
for (int i=0; i < 2; ++i)a=2;
|
||||
// CHECK-NEXT: for (int i = 0; i < 2; ++i)
|
||||
// CHECK-NEXT: a = 2;
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute private(argc, b), firstprivate(c, d), collapse(2)
|
||||
for (int i = 0; i < 10; ++i)
|
||||
for (int j = 0; j < 10; ++j)foo();
|
||||
// CHECK-NEXT: #pragma omp target
|
||||
// CHECK-NEXT: #pragma omp teams
|
||||
// CHECK-NEXT: #pragma omp distribute private(argc,b) firstprivate(c,d) collapse(2)
|
||||
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
|
||||
// CHECK-NEXT: for (int j = 0; j < 10; ++j)
|
||||
// CHECK-NEXT: foo();
|
||||
for (int i = 0; i < 10; ++i)foo();
|
||||
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
|
||||
// CHECK-NEXT: foo();
|
||||
#pragma omp distribute
|
||||
// CHECK: #pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i)foo();
|
||||
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
|
||||
// CHECK-NEXT: foo();
|
||||
return T();
|
||||
}
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
int b = argc, c, d, e, f, g;
|
||||
static int a;
|
||||
// CHECK: static int a;
|
||||
#pragma omp distribute
|
||||
// CHECK-NEXT: #pragma omp distribute
|
||||
for (int i=0; i < 2; ++i)a=2;
|
||||
// CHECK-NEXT: for (int i = 0; i < 2; ++i)
|
||||
// CHECK-NEXT: a = 2;
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute private(argc,b),firstprivate(argv, c), collapse(2)
|
||||
for (int i = 0; i < 10; ++i)
|
||||
for (int j = 0; j < 10; ++j)foo();
|
||||
// CHECK-NEXT: #pragma omp target
|
||||
// CHECK-NEXT: #pragma omp teams
|
||||
// CHECK-NEXT: #pragma omp distribute private(argc,b) firstprivate(argv,c) collapse(2)
|
||||
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
|
||||
// CHECK-NEXT: for (int j = 0; j < 10; ++j)
|
||||
// CHECK-NEXT: foo();
|
||||
for (int i = 0; i < 10; ++i)foo();
|
||||
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
|
||||
// CHECK-NEXT: foo();
|
||||
#pragma omp distribute
|
||||
// CHECK: #pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i)foo();
|
||||
// CHECK-NEXT: for (int i = 0; i < 10; ++i)
|
||||
// CHECK-NEXT: foo();
|
||||
return (0);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,83 +0,0 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp %s
|
||||
|
||||
void foo() {
|
||||
}
|
||||
|
||||
bool foobool(int argc) {
|
||||
return argc;
|
||||
}
|
||||
|
||||
struct S1; // expected-note {{declared here}}
|
||||
|
||||
template <class T, typename S, int N, int ST> // expected-note {{declared here}}
|
||||
T tmain(T argc, S **argv) { //expected-note 2 {{declared here}}
|
||||
#pragma omp distribute 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 distribute 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 distribute collapse () // expected-error {{expected expression}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
// expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
|
||||
// expected-error@+2 2 {{expression is not an integral constant expression}}
|
||||
// expected-note@+1 2 {{read of non-const variable 'argc' is not allowed in a constant expression}}
|
||||
#pragma omp distribute collapse (argc
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
// expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}}
|
||||
#pragma omp distribute collapse (ST // 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 distribute collapse (1)) // expected-warning {{extra tokens at the end of '#pragma omp distribute' are ignored}}
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp distribute 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 distribute', but found only 1}}
|
||||
// expected-error@+3 2 {{directive '#pragma omp distribute' 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}}
|
||||
#pragma omp distribute collapse (foobool(argc)), collapse (true), collapse (-5)
|
||||
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}}
|
||||
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 distribute collapse (argv[1]=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 distribute collapse (1)
|
||||
for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp distribute collapse (N) // expected-error {{argument to 'collapse' clause must be a strictly positive integer value}}
|
||||
for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
|
||||
#pragma omp distribute collapse (2) // expected-note {{as specified in 'collapse' clause}}
|
||||
foo(); // expected-error {{expected 2 for loops after '#pragma omp distribute'}}
|
||||
return argc;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
#pragma omp distribute 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 distribute collapse ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp distribute collapse () // expected-error {{expected expression}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp distribute collapse (4 // expected-error {{expected ')'}} expected-note {{to match this '('}} 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 distribute', but found only 1}}
|
||||
#pragma omp distribute collapse (2+2)) // expected-warning {{extra tokens at the end of '#pragma omp distribute' 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 distribute', but found only 1}}
|
||||
#pragma omp distribute collapse (foobool(1) > 0 ? 1 : 2) // expected-error {{expression is not an integral constant expression}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
// expected-error@+3 {{expression is not an integral constant expression}}
|
||||
// expected-error@+2 2 {{directive '#pragma omp distribute' cannot contain more than one 'collapse' clause}}
|
||||
// expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}}
|
||||
#pragma omp distribute collapse (foobool(argc)), collapse (true), collapse (-5)
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
#pragma omp distribute collapse (S1) // expected-error {{'S1' does not refer to a value}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
// expected-error@+1 {{expression is not an integral constant expression}}
|
||||
#pragma omp distribute collapse (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
|
||||
// expected-error@+3 {{statement after '#pragma omp distribute' must be a for loop}}
|
||||
// expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}
|
||||
#pragma omp distribute collapse(collapse(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
|
||||
foo();
|
||||
#pragma omp distribute collapse (2) // expected-note {{as specified in 'collapse' clause}}
|
||||
foo(); // expected-error {{expected 2 for loops after '#pragma omp distribute'}}
|
||||
// expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 1, 0>' requested here}}
|
||||
return tmain<int, char, 1, 0>(argc, argv);
|
||||
}
|
||||
|
|
@ -1,157 +0,0 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp %s
|
||||
|
||||
void foo() {
|
||||
}
|
||||
|
||||
bool foobool(int argc) {
|
||||
return argc;
|
||||
}
|
||||
|
||||
struct S1; // expected-note {{declared here}} expected-note{{forward declaration of 'S1'}}
|
||||
extern S1 a;
|
||||
class S2 {
|
||||
mutable int a;
|
||||
|
||||
public:
|
||||
S2() : a(0) {}
|
||||
S2(const S2 &s2) : a(s2.a) {}
|
||||
static float S2s;
|
||||
static const float S2sc;
|
||||
};
|
||||
const float S2::S2sc = 0;
|
||||
const S2 b;
|
||||
const S2 ba[5];
|
||||
class S3 {
|
||||
int a;
|
||||
S3 &operator=(const S3 &s3);
|
||||
|
||||
public:
|
||||
S3() : a(0) {} // expected-note {{candidate constructor not viable: requires 0 arguments, but 1 was provided}}
|
||||
S3(S3 &s3) : a(s3.a) {} // expected-note {{candidate constructor not viable: 1st argument ('const S3') would lose const qualifier}}
|
||||
};
|
||||
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) { }
|
||||
};
|
||||
class S6 {
|
||||
int a;
|
||||
public:
|
||||
S6() : a(0) { }
|
||||
};
|
||||
|
||||
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);
|
||||
S6 p;
|
||||
int i;
|
||||
int &j = i;
|
||||
#pragma omp distribute firstprivate // expected-error {{expected '(' after 'firstprivate'}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp distribute firstprivate ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp distribute firstprivate () // expected-error {{expected expression}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute firstprivate (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute firstprivate (argc, // 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
|
||||
#pragma omp distribute firstprivate (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute firstprivate (argc)
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute firstprivate (S1) // expected-error {{'S1' does not refer to a value}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute firstprivate (argv[1]) // expected-error {{expected variable name}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute firstprivate(ba)
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute firstprivate(ca) // expected-error {{no matching constructor for initialization of 'S3'}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute firstprivate(da)
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute firstprivate(S2::S2s)
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute firstprivate(S2::S2sc)
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute private(i), firstprivate(i) // expected-error {{private variable cannot be firstprivate}} expected-note{{defined as private}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams shared(i)
|
||||
#pragma omp distribute firstprivate(i)
|
||||
for (j = 0; j < argc; ++j) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams shared(i)
|
||||
#pragma omp distribute firstprivate(i) // expected-note {{defined as firstprivate}}
|
||||
for (i = 0; i < argc; ++i) foo(); // expected-error {{loop iteration variable in the associated loop of 'omp distribute' directive may not be firstprivate, predetermined as private}}
|
||||
#pragma omp target
|
||||
#pragma omp teams private(argc) // expected-note {{defined as private}}
|
||||
#pragma omp distribute firstprivate(argc) // expected-error {{private variable in '#pragma omp teams' cannot be firstprivate in '#pragma omp distribute'}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams reduction(+:argc) // expected-note {{defined as reduction}}
|
||||
#pragma omp distribute firstprivate(argc) // expected-error {{reduction variable in '#pragma omp teams' cannot be firstprivate in '#pragma omp distribute'}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute firstprivate(j)
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute lastprivate(argc), firstprivate(argc) // expected-error {{lastprivate variable cannot be firstprivate in '#pragma omp distribute'}} expected-note{{defined as lastprivate}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute firstprivate(argc), lastprivate(argc) // expected-error {{lastprivate variable cannot be firstprivate in '#pragma omp distribute'}} expected-note{{defined as firstprivate}}
|
||||
for (i = 0; i < argc; ++i) foo();
|
||||
return 0;
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -ferror-limit 100 %s
|
||||
|
||||
void foo() {
|
||||
}
|
||||
|
||||
bool foobool(int argc) {
|
||||
return argc;
|
||||
}
|
||||
|
||||
struct S1; // expected-note {{declared here}} expected-note {{forward declaration of 'S1'}}
|
||||
extern S1 a;
|
||||
class S2 {
|
||||
mutable int a;
|
||||
public:
|
||||
S2():a(0) { }
|
||||
static float S2s; // expected-note {{predetermined as shared}}
|
||||
};
|
||||
const S2 b;
|
||||
const S2 ba[5];
|
||||
class S3 {
|
||||
int a;
|
||||
public:
|
||||
S3():a(0) { }
|
||||
};
|
||||
const S3 c; // expected-note {{predetermined as shared}}
|
||||
const S3 ca[5]; // expected-note {{predetermined as shared}}
|
||||
extern const int f; // expected-note {{predetermined as shared}}
|
||||
class S4 {
|
||||
int a;
|
||||
S4(); // expected-note {{implicitly declared private here}}
|
||||
public:
|
||||
S4(int v):a(v) { }
|
||||
};
|
||||
class S5 {
|
||||
int a;
|
||||
S5():a(0) {} // expected-note {{implicitly declared private here}}
|
||||
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; // expected-note {{predetermined as shared}}
|
||||
const int da[5] = { 0 }; // expected-note {{predetermined as shared}}
|
||||
S4 e(4);
|
||||
S5 g(5);
|
||||
int i;
|
||||
int &j = i;
|
||||
#pragma omp distribute private // expected-error {{expected '(' after 'private'}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp distribute private ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp distribute private () // expected-error {{expected expression}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp distribute private (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp distribute private (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp distribute private (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp distribute private (argc)
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp distribute private (S1) // expected-error {{'S1' does not refer to a value}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp distribute private (a, b, c, d, f) // expected-error {{private variable with incomplete type 'S1'}} expected-error 3 {{shared variable cannot be private}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp distribute private (argv[1]) // expected-error {{expected variable name}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp distribute private(ba)
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp distribute private(ca) // expected-error {{shared variable cannot be private}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp distribute private(da) // expected-error {{shared variable cannot be private}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp distribute private(S2::S2s) // expected-error {{shared variable cannot be private}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp distribute private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp distribute private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp distribute shared(i) // expected-error {{unexpected OpenMP clause 'shared' in directive '#pragma omp distribute'}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
{
|
||||
int i; // expected-note {{predetermined as private}}
|
||||
#pragma omp distribute firstprivate(i), private(i) // expected-error {{private variable cannot be firstprivate}}
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams private(i)
|
||||
#pragma omp distribute private(j)
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp parallel private(i)
|
||||
#pragma omp target
|
||||
#pragma omp teams firstprivate(i)
|
||||
#pragma omp parallel private(i)
|
||||
#pragma omp target
|
||||
#pragma omp teams reduction(+:i)
|
||||
#pragma omp distribute private(i)
|
||||
for (int k = 0; k < argc; ++k) ++k;
|
||||
#pragma omp distribute private(i)
|
||||
for (int k = 0; k < 10; ++k) {
|
||||
#pragma omp target
|
||||
#pragma omp teams private(i)
|
||||
#pragma omp distribute private(i)
|
||||
for (int x = 0; x < 10; ++x) foo();
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute firstprivate(i)
|
||||
for (int k = 0; k < 10; ++k) {
|
||||
#pragma omp target
|
||||
#pragma omp teams firstprivate(i)
|
||||
#pragma omp distribute private(i)
|
||||
for (int x = 0; x < 10; ++x) foo();
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams reduction(+:i)
|
||||
#pragma omp distribute
|
||||
for (int k = 0; k < 10; ++k) {
|
||||
#pragma omp target
|
||||
#pragma omp teams reduction(+:i)
|
||||
#pragma omp distribute private(i)
|
||||
for (int x = 0; x < 10; ++x) foo();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -106,12 +106,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp parallel
|
||||
{
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// SIMD DIRECTIVE
|
||||
#pragma omp simd
|
||||
|
@ -245,12 +239,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int j = 0; j < 10; ++j)
|
||||
;
|
||||
}
|
||||
|
||||
// FOR DIRECTIVE
|
||||
#pragma omp for
|
||||
|
@ -407,12 +395,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp for
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int j = 0; j < 10; ++j)
|
||||
;
|
||||
}
|
||||
|
||||
// FOR SIMD DIRECTIVE
|
||||
#pragma omp for simd
|
||||
|
@ -546,12 +528,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int j = 0; j < 10; ++j)
|
||||
;
|
||||
}
|
||||
|
||||
// SECTIONS DIRECTIVE
|
||||
#pragma omp sections
|
||||
|
@ -715,12 +691,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp sections
|
||||
{
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// SECTION DIRECTIVE
|
||||
#pragma omp section // expected-error {{orphaned 'omp section' directives are prohibited, it must be closely nested to a sections region}}
|
||||
|
@ -921,13 +891,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp sections
|
||||
{
|
||||
#pragma omp section
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// SINGLE DIRECTIVE
|
||||
#pragma omp single
|
||||
|
@ -1074,12 +1037,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp single
|
||||
{
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// MASTER DIRECTIVE
|
||||
#pragma omp master
|
||||
|
@ -1226,12 +1183,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp master
|
||||
{
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// CRITICAL DIRECTIVE
|
||||
#pragma omp critical
|
||||
|
@ -1392,12 +1343,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp critical
|
||||
{
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// PARALLEL FOR DIRECTIVE
|
||||
#pragma omp parallel for
|
||||
|
@ -1559,12 +1504,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp parallel for
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int j = 0; j < 10; ++j)
|
||||
;
|
||||
}
|
||||
|
||||
// PARALLEL FOR SIMD DIRECTIVE
|
||||
#pragma omp parallel for simd
|
||||
|
@ -1726,12 +1665,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int j = 0; j < 10; ++j)
|
||||
;
|
||||
}
|
||||
|
||||
// PARALLEL SECTIONS DIRECTIVE
|
||||
#pragma omp parallel sections
|
||||
|
@ -1884,12 +1817,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// TASK DIRECTIVE
|
||||
#pragma omp task
|
||||
|
@ -1988,12 +1915,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp task
|
||||
{
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// ORDERED DIRECTIVE
|
||||
#pragma omp ordered
|
||||
|
@ -2140,12 +2061,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp ordered
|
||||
{
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'ordered' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// ATOMIC DIRECTIVE
|
||||
#pragma omp atomic
|
||||
|
@ -2323,14 +2238,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp atomic
|
||||
// expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
|
||||
// expected-note@+1 {{expected an expression statement}}
|
||||
{
|
||||
#pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// TARGET DIRECTIVE
|
||||
#pragma omp target
|
||||
|
@ -2442,12 +2349,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp target
|
||||
{
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// TEAMS DIRECTIVE
|
||||
#pragma omp target
|
||||
|
@ -2575,19 +2476,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp distribute
|
||||
for (int j = 0; j < 10; ++j)
|
||||
;
|
||||
|
||||
// TASKLOOP DIRECTIVE
|
||||
#pragma omp taskloop
|
||||
|
@ -2739,194 +2627,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
// DISTRIBUTE DIRECTIVE
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp for
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp sections
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a distribute region}}
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp single
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp master
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp critical
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel
|
||||
{
|
||||
#pragma omp single
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel for
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp task
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp taskyield
|
||||
bar();
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp barrier
|
||||
bar();
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp taskwait
|
||||
bar();
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp flush
|
||||
bar();
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp ordered // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
|
||||
bar();
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp atomic
|
||||
++a;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp target
|
||||
++a;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp teams // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
|
||||
++a;
|
||||
}
|
||||
}
|
||||
|
||||
void foo() {
|
||||
|
@ -3032,12 +2732,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp parallel
|
||||
{
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'parallel' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// SIMD DIRECTIVE
|
||||
#pragma omp simd
|
||||
|
@ -3164,12 +2858,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int j = 0; j < 10; ++j)
|
||||
;
|
||||
}
|
||||
|
||||
// FOR DIRECTIVE
|
||||
#pragma omp for
|
||||
|
@ -3316,12 +3004,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp for
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int j = 0; j < 10; ++j)
|
||||
;
|
||||
}
|
||||
|
||||
// FOR SIMD DIRECTIVE
|
||||
#pragma omp for simd
|
||||
|
@ -3448,12 +3130,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int j = 0; j < 10; ++j)
|
||||
;
|
||||
}
|
||||
|
||||
// SECTIONS DIRECTIVE
|
||||
#pragma omp sections
|
||||
|
@ -3592,12 +3268,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp sections
|
||||
{
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'sections' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// SECTION DIRECTIVE
|
||||
#pragma omp section // expected-error {{orphaned 'omp section' directives are prohibited, it must be closely nested to a sections region}}
|
||||
|
@ -3806,13 +3476,6 @@ void foo() {
|
|||
++a;
|
||||
}
|
||||
}
|
||||
#pragma omp sections
|
||||
{
|
||||
#pragma omp section
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'section' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// SINGLE DIRECTIVE
|
||||
#pragma omp single
|
||||
|
@ -3949,12 +3612,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp single
|
||||
{
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'single' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// MASTER DIRECTIVE
|
||||
#pragma omp master
|
||||
|
@ -4101,12 +3758,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp master
|
||||
{
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'master' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// CRITICAL DIRECTIVE
|
||||
#pragma omp critical
|
||||
|
@ -4272,12 +3923,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp critical
|
||||
{
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'critical' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// PARALLEL FOR DIRECTIVE
|
||||
#pragma omp parallel for
|
||||
|
@ -4439,12 +4084,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp parallel for
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int j = 0; j < 10; ++j)
|
||||
;
|
||||
}
|
||||
|
||||
// PARALLEL FOR SIMD DIRECTIVE
|
||||
#pragma omp parallel for simd
|
||||
|
@ -4606,12 +4245,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside a simd region}}
|
||||
for (int j = 0; j < 10; ++j)
|
||||
;
|
||||
}
|
||||
|
||||
// PARALLEL SECTIONS DIRECTIVE
|
||||
#pragma omp parallel sections
|
||||
|
@ -4760,12 +4393,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'parallel sections' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// TASK DIRECTIVE
|
||||
#pragma omp task
|
||||
|
@ -4863,12 +4490,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp task
|
||||
{
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'task' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// ATOMIC DIRECTIVE
|
||||
#pragma omp atomic
|
||||
|
@ -5046,14 +4667,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp atomic
|
||||
// expected-error@+2 {{the statement for 'atomic' must be an expression statement of form '++x;', '--x;', 'x++;', 'x--;', 'x binop= expr;', 'x = x binop expr' or 'x = expr binop x', where x is an l-value expression with scalar type}}
|
||||
// expected-note@+1 {{expected an expression statement}}
|
||||
{
|
||||
#pragma omp distribute // expected-error {{OpenMP constructs may not be nested inside an atomic region}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// TARGET DIRECTIVE
|
||||
#pragma omp target
|
||||
|
@ -5165,12 +4778,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp target
|
||||
{
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'target' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
|
||||
// TEAMS DIRECTIVE
|
||||
#pragma omp target
|
||||
|
@ -5298,19 +4905,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
#pragma omp distribute
|
||||
for (int j = 0; j < 10; ++j)
|
||||
;
|
||||
|
||||
// TASKLOOP DIRECTIVE
|
||||
#pragma omp taskloop
|
||||
|
@ -5462,195 +5056,6 @@ void foo() {
|
|||
for (int i = 0; i < 10; ++i)
|
||||
++a;
|
||||
}
|
||||
|
||||
// DISTRIBUTE DIRECTIVE
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp distribute // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp distribute' directive into a teams region?}}
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp for
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp sections
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp section // expected-error {{'omp section' directive must be closely nested to a sections region, not a distribute region}}
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp single
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp master
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp critical
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel
|
||||
{
|
||||
#pragma omp single
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel for
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel for simd
|
||||
for (int i = 0; i < 10; ++i)
|
||||
;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp parallel sections
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp task
|
||||
{
|
||||
bar();
|
||||
}
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp taskyield
|
||||
bar();
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp barrier
|
||||
bar();
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp taskwait
|
||||
bar();
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp flush
|
||||
bar();
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp ordered // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp ordered' directive into a for or a parallel for region with 'ordered' clause?}}
|
||||
bar();
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp atomic
|
||||
++a;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp target
|
||||
++a;
|
||||
}
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#pragma omp distribute
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
#pragma omp teams // expected-error {{region cannot be closely nested inside 'distribute' region; perhaps you forget to enclose 'omp teams' directive into a target region?}}
|
||||
++a;
|
||||
}
|
||||
return foo<int>();
|
||||
}
|
||||
|
||||
|
|
|
@ -1944,7 +1944,6 @@ public:
|
|||
void VisitOMPTeamsDirective(const OMPTeamsDirective *D);
|
||||
void VisitOMPTaskLoopDirective(const OMPTaskLoopDirective *D);
|
||||
void VisitOMPTaskLoopSimdDirective(const OMPTaskLoopSimdDirective *D);
|
||||
void VisitOMPDistributeDirective(const OMPDistributeDirective *D);
|
||||
|
||||
private:
|
||||
void AddDeclarationNameInfo(const Stmt *S);
|
||||
|
@ -2633,11 +2632,6 @@ void EnqueueVisitor::VisitOMPTaskLoopSimdDirective(
|
|||
VisitOMPLoopDirective(D);
|
||||
}
|
||||
|
||||
void EnqueueVisitor::VisitOMPDistributeDirective(
|
||||
const OMPDistributeDirective *D) {
|
||||
VisitOMPLoopDirective(D);
|
||||
}
|
||||
|
||||
void CursorVisitor::EnqueueWorkList(VisitorWorkList &WL, const Stmt *S) {
|
||||
EnqueueVisitor(WL, MakeCXCursor(S, StmtParent, TU,RegionOfInterest)).Visit(S);
|
||||
}
|
||||
|
@ -4498,8 +4492,6 @@ CXString clang_getCursorKindSpelling(enum CXCursorKind Kind) {
|
|||
return cxstring::createRef("OMPTaskLoopDirective");
|
||||
case CXCursor_OMPTaskLoopSimdDirective:
|
||||
return cxstring::createRef("OMPTaskLoopSimdDirective");
|
||||
case CXCursor_OMPDistributeDirective:
|
||||
return cxstring::createRef("OMPDistributeDirective");
|
||||
case CXCursor_OverloadCandidate:
|
||||
return cxstring::createRef("OverloadCandidate");
|
||||
case CXCursor_TypeAliasTemplateDecl:
|
||||
|
|
|
@ -613,9 +613,6 @@ CXCursor cxcursor::MakeCXCursor(const Stmt *S, const Decl *Parent,
|
|||
case Stmt::OMPTaskLoopSimdDirectiveClass:
|
||||
K = CXCursor_OMPTaskLoopSimdDirective;
|
||||
break;
|
||||
case Stmt::OMPDistributeDirectiveClass:
|
||||
K = CXCursor_OMPDistributeDirective;
|
||||
break;
|
||||
}
|
||||
|
||||
CXCursor C = { K, 0, { Parent, S, TU } };
|
||||
|
|
Loading…
Reference in New Issue