summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2017-12-13 17:31:39 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2017-12-13 17:31:39 +0000
commit3f96fe6d44774c8f892ff9b678c9cfa1d6df1539 (patch)
tree1ffa72f411628a37785685b516a5c8938f22a1be /clang/lib/Sema
parentdde93259a3e8296bc5b9ec69e67c5aec88f16e8e (diff)
downloadbcm5719-llvm-3f96fe6d44774c8f892ff9b678c9cfa1d6df1539.tar.gz
bcm5719-llvm-3f96fe6d44774c8f892ff9b678c9cfa1d6df1539.zip
[OPENMP] Support `reduction` clause on target-based directives.
OpenMP 5.0 added support for `reduction` clause in target-based directives. Patch adds this support to clang. llvm-svn: 320596
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaOpenMP.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 22da8adb2fe..4aa47e08792 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -1279,9 +1279,13 @@ bool Sema::IsOpenMPCapturedByRef(ValueDecl *D, unsigned Level) {
// reference except if it is a pointer that is dereferenced somehow.
IsByRef = !(Ty->isPointerType() && IsVariableAssociatedWithSection);
} else {
- // By default, all the data that has a scalar type is mapped by copy.
- IsByRef = !Ty->isScalarType() ||
- DSAStack->getDefaultDMAAtLevel(Level) == DMA_tofrom_scalar;
+ // By default, all the data that has a scalar type is mapped by copy
+ // (except for reduction variables).
+ IsByRef =
+ !Ty->isScalarType() ||
+ DSAStack->getDefaultDMAAtLevel(Level) == DMA_tofrom_scalar ||
+ DSAStack->hasExplicitDSA(
+ D, [](OpenMPClauseKind K) { return K == OMPC_reduction; }, Level);
}
}
OpenPOWER on IntegriCloud