[PATCH] D18286: [OPENMP] private and firstprivate clauses of teams code generation for nvptx

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Sun Mar 20 23:26:27 PDT 2016


ABataev added inline comments.

================
Comment at: lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:53-57
@@ -52,2 +52,7 @@
   auto &&CodeGen = [&D](CodeGenFunction &CGF) {
+    CodeGenFunction::OMPPrivateScope PrivateScope(CGF);
+    (void)CGF.EmitOMPFirstprivateClause(D, PrivateScope);
+    CGF.EmitOMPPrivateClause(D, PrivateScope);
+    (void)PrivateScope.Privatize();
+
     CGF.EmitStmt(cast<CapturedStmt>(D.getAssociatedStmt())->getCapturedStmt());
----------------
After some investigation I found out that this the same code, that a;ready exists in CodeGenFunction::EmitOMPTeamsDirective(). 
I think you must remove emitTeamsCall() from CGOpenMPRuntimeNVPTX class and modify CodeGenFunction::EmitOMPTeamsDirective() like this:
```
void CodeGenFunction::EmitOMPTeamsDirective(const OMPTeamsDirective &S) {
  OMPLexicalScope(*this, S);
  // Emit parallel region as a standalone region.
  auto &&CodeGen = [&S](CodeGenFunction &CGF) {
    OMPPrivateScope PrivateScope(CGF);
    (void)CGF.EmitOMPFirstprivateClause(S, PrivateScope);
    CGF.EmitOMPPrivateClause(S, PrivateScope);
    (void)PrivateScope.Privatize();
    CGF.EmitStmt(cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt());
  };
  if (getLangOpts().OpenMPIsDevice)
    emitInlinedDirective(CGF, OMPD_teams, CodeGen);
  else
    emitCommonOMPTeamsDirective(*this, S, OMPD_teams, CodeGen);
}
```


Repository:
  rL LLVM

http://reviews.llvm.org/D18286





More information about the cfe-commits mailing list