diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2017-12-13 17:31:39 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2017-12-13 17:31:39 +0000 |
| commit | 3f96fe6d44774c8f892ff9b678c9cfa1d6df1539 (patch) | |
| tree | 1ffa72f411628a37785685b516a5c8938f22a1be /clang/lib/Sema | |
| parent | dde93259a3e8296bc5b9ec69e67c5aec88f16e8e (diff) | |
| download | bcm5719-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.cpp | 10 |
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); } } |

