ABataev requested changes to this revision. This revision now requires changes to proceed.
================ Comment at: include/clang/AST/OpenMPClause.h:4252 @@ -4237,1 +4251,3 @@ + + /// \brief Build clause with number of variables \a NumVars. /// ---------------- No \brief ================ Comment at: include/clang/AST/OpenMPClause.h:4272 @@ -4247,3 +4271,3 @@ /// \brief Build an empty clause. /// ---------------- Remove \brief ================ Comment at: include/clang/AST/OpenMPClause.h:4289-4309 @@ +4288,23 @@ + + /// \brief Sets the list of references to private copies with initializers for + /// new private variables. + /// \param VL List of references. + void setPrivateCopies(ArrayRef<Expr *> VL); + + /// \brief Gets the list of references to private copies with initializers for + /// new private variables. + MutableArrayRef<Expr *> getPrivateCopies() { + return MutableArrayRef<Expr *>(varlist_end(), varlist_size()); + } + ArrayRef<const Expr *> getPrivateCopies() const { + return llvm::makeArrayRef(varlist_end(), varlist_size()); + } + + /// \brief Sets the list of references to initializer variables for new + /// private variables. + /// \param VL List of references. + void setInits(ArrayRef<Expr *> VL); + + /// \brief Gets the list of references to initializer variables for new + /// private variables. + MutableArrayRef<Expr *> getInits() { ---------------- No \brief ================ Comment at: include/clang/AST/OpenMPClause.h:4318 @@ -4257,3 +4317,3 @@ public: - /// Creates clause with a list of variables \a VL. + /// \brief Creates clause with a list of variables \a Vars. /// ---------------- Do not add \brief ================ Comment at: include/clang/AST/OpenMPClause.h:4336 @@ -4270,1 +4335,3 @@ + + /// \brief Creates an empty clause with the place for \a NumVars variables. /// ---------------- Do not add \brief ================ Comment at: lib/CodeGen/CGStmtOpenMP.cpp:3410-3411 @@ +3409,4 @@ + llvm::DenseSet<const VarDecl *> EmittedAsFirstprivate; + CGCapturedStmtInfo CapturesInfo(cast<CapturedStmt>(*D.getAssociatedStmt())); + for (const auto *C : D.getClausesOfKind<OMPUseDevicePtrClause>()) { + auto OrigVarIt = C->varlist_begin(); ---------------- EmitOMPUseDevicePtrClause() should emit the code for single clause. The outer loop must be used in directive emission function. ================ Comment at: lib/CodeGen/CGStmtOpenMP.cpp:3477-3495 @@ +3476,21 @@ + // Codegen with device pointer privatization. + auto &&PvtCodeGen = [&S, &Info](CodeGenFunction &CGF, PrePostActionTy &) { + auto &&CodeGen = [&S, &Info](CodeGenFunction &CGF, PrePostActionTy &) { + OMPPrivateScope PrivateScope(CGF); + CGF.EmitOMPUseDevicePtrClause(S, PrivateScope, Info.CaptureDeviceAddrMap); + (void)PrivateScope.Privatize(); + CGF.EmitStmt( + cast<CapturedStmt>(S.getAssociatedStmt())->getCapturedStmt()); + }; + // Notwithstanding the body of the region is emitted as inlined directive, + // we don't use an inline scope as changes in the references inside the + // region are expected to be visible outside, so we do not privative them. + OMPLexicalScope Scope(CGF, S); + CGF.CGM.getOpenMPRuntime().emitInlinedDirective(CGF, OMPD_target_data, + CodeGen); + }; + + // Codegen with no device pointer privatization. + auto &&NoPvtCodeGen = [&S, &Info](CodeGenFunction &CGF, PrePostActionTy &) { + auto &&CodeGen = [&S, &Info](CodeGenFunction &CGF, PrePostActionTy &) { + CGF.EmitStmt( ---------------- PvtCodeGen and NoPvtCodeGen are pretty similar. Could you merge them somehow into the one? Maybe some custom PrePostAction could be used here? ================ Comment at: lib/Sema/SemaOpenMP.cpp:11858 @@ +11857,3 @@ + // similar properties of a first private variable. + DSAStack->addDSA(D, RefExpr->IgnoreParens(), OMPC_firstprivate, Ref); + ---------------- Are the restrictions for firstprivates applied also? What if inner directive has some clauses that cannot be used with variables previously marked as firstprivates, but can be used with variables, used in use_device_ptr? https://reviews.llvm.org/D22691 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits