[OPENMP50]Codegen support for order(concurrent) clause.
Emit llvm parallel access metadata for the loops if they are marked as
order(concurrent).
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index a84f2fe..827ea213 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -1931,6 +1931,9 @@
LoopStack.setParallel(!IsMonotonic);
LoopStack.setVectorizeEnable();
emitSimdlenSafelenClause(*this, D, IsMonotonic);
+ if (const auto *C = D.getSingleClause<OMPOrderClause>())
+ if (C->getKind() == OMPC_ORDER_concurrent)
+ LoopStack.setParallel(/*Enable=*/true);
}
void CodeGenFunction::EmitOMPSimdFinal(
@@ -2202,10 +2205,14 @@
[&S, IsMonotonic](CodeGenFunction &CGF, PrePostActionTy &) {
// Generate !llvm.loop.parallel metadata for loads and stores for loops
// with dynamic/guided scheduling and without ordered clause.
- if (!isOpenMPSimdDirective(S.getDirectiveKind()))
+ if (!isOpenMPSimdDirective(S.getDirectiveKind())) {
CGF.LoopStack.setParallel(!IsMonotonic);
- else
+ if (const auto *C = S.getSingleClause<OMPOrderClause>())
+ if (C->getKind() == OMPC_ORDER_concurrent)
+ CGF.LoopStack.setParallel(/*Enable=*/true);
+ } else {
CGF.EmitOMPSimdInit(S, IsMonotonic);
+ }
},
[&S, &LoopArgs, LoopExit, &CodeGenLoop, IVSize, IVSigned, &CodeGenOrdered,
&LoopScope](CodeGenFunction &CGF, PrePostActionTy &) {
@@ -2720,8 +2727,12 @@
emitCommonSimdLoop(
*this, S,
[&S](CodeGenFunction &CGF, PrePostActionTy &) {
- if (isOpenMPSimdDirective(S.getDirectiveKind()))
+ if (isOpenMPSimdDirective(S.getDirectiveKind())) {
CGF.EmitOMPSimdInit(S, /*IsMonotonic=*/true);
+ } else if (const auto *C = S.getSingleClause<OMPOrderClause>()) {
+ if (C->getKind() == OMPC_ORDER_concurrent)
+ CGF.LoopStack.setParallel(/*Enable=*/true);
+ }
},
[IVSize, IVSigned, Ordered, IL, LB, UB, ST, StaticChunkedOne, Chunk,
&S, ScheduleKind, LoopExit,