[PATCH] D18203: [OPENMP] Implementation of codegen for firstprivate clause of target directive

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 15 22:41:39 PDT 2016


ABataev added inline comments.

================
Comment at: lib/Sema/SemaOpenMP.cpp:9779-9780
@@ +9778,4 @@
+    if (DKind == OMPD_target) {
+      if(VD && DSAStack->isPrivate(VD)) {
+        auto DVar = DSAStack->getTopDSA(VD, false);
+        Diag(ELoc, diag::err_omp_variable_in_map_and_dsa)
----------------
You still use `getTopDSA()` here, maybe it is better to not call `isPrivate()` and use direct checks like this:
```
auto DVar = DSAStack->getTopDSA(D, false);
if (VD && isOpenMPPrivate(DVar.CKind))
 .....
```
Besides, I don't think we need `isPrivate()` and `isFirstPrivate()` member functions.

================
Comment at: lib/Sema/SemaOpenMP.cpp:9782-9783
@@ +9781,4 @@
+        Diag(ELoc, diag::err_omp_variable_in_map_and_dsa)
+            << getOpenMPClauseName(DSAStack->isFirstPrivate(VD) ?
+                                   OMPC_firstprivate : OMPC_private)
+            << getOpenMPDirectiveName(DSAStack->getCurrentDirective());
----------------
Again, `DSAStack->isFirstPrivate(VD) ? OMPC_firstprivate : OMPC_private` can be replaced by simple code like this one `DVar.CKind`
Also, additional checks must be added to private clauses, which does not allow to privatize variables, that already are mapped. Maybe you need to use new DSA kind `OMPC_map` and mark all mapped variables as one having `OMPC_map` data-sharing attribute?


Repository:
  rL LLVM

http://reviews.llvm.org/D18203





More information about the cfe-commits mailing list