[PATCH] D75591: [OpenMP] Add firstprivate as a default data-sharing attribute to clang

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 11 14:01:34 PDT 2020


ABataev added inline comments.


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:38
 #include "llvm/Frontend/OpenMP/OMPConstants.h"
+#include "llvm/Support/ErrorHandling.h"
 #include <set>
----------------
Why do you need this here?


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:2016-2023
+  if (DSAStack->getDefaultDSA() == DSA_firstprivate &&
+      VarsWithInheritedDSAType().count(D) == 0 &&
+      !DSAStack->hasExplicitDSA(
+          D, [](OpenMPClauseKind K) -> bool { return K == OMPC_firstprivate; },
+          Level, /*NotLastprivate=*/true) &&
+      Ty.getNonReferenceType()->isScalarType()) {
+    IsByRef = false;
----------------
atmnpatel wrote:
> @ABataev Is this what you mean?
Did you try to compile it? What is `VarsWithInheritedDSAType`, where is it declared and defined? You just need to check for something like this:
```
DSAStack->getDefaultDSA() == DSA_firstprivate && Ty->isScalarType() && !DSAStack->hasExplicitDSA(D, [](OpenMPClauseKind K) {return K != OMPC_unknown;} && !DSAStack->isLoopControlVariable(D, Level).first
```
i.e. the default DSA is firstprivate, the type is scalar, no explicit DSA for this variable and the variable is not a loop control variable.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75591/new/

https://reviews.llvm.org/D75591





More information about the cfe-commits mailing list