ABataev added a comment. Carlo, thanks for the patch! Please update the code to trunk HEAD
================ Comment at: lib/CodeGen/CGOpenMPRuntime.h:677 @@ -676,1 +676,3 @@ + virtual bool isStaticNonchunked(OpenMPDistScheduleClauseKind ScheduleKind, + bool Chunked) const; ---------------- Add comment for the function ================ Comment at: lib/CodeGen/CGOpenMPRuntime.h:686-694 @@ -682,13 +685,11 @@ virtual void emitForDispatchInit(CodeGenFunction &CGF, SourceLocation Loc, OpenMPScheduleClauseKind SchedKind, unsigned IVSize, bool IVSigned, bool Ordered, llvm::Value *UB, llvm::Value *Chunk = nullptr); - /// \brief Call the appropriate runtime routine to initialize it before start - /// of loop. - /// - /// Depending on the loop schedule, it is nesessary to call some runtime - /// routine before start of the OpenMP loop to get the loop upper / lower - /// bounds \a LB and \a UB and stride \a ST. + union OMPGenericSchedule { + OpenMPScheduleClauseKind forSchedule; + OpenMPDistScheduleClauseKind distributeSchedule; + }; ---------------- I don't like union also. I think we can avoid using this ================ Comment at: lib/CodeGen/CGOpenMPRuntime.h:718 @@ -715,2 +717,3 @@ + bool isForSchedule, unsigned IVSize, bool IVSigned, bool Ordered, Address IL, Address LB, ---------------- Add separate function, but outline the body for these 2 functions into a static function ================ Comment at: lib/CodeGen/CGStmtOpenMP.cpp:1540-1541 @@ +1539,4 @@ + + const Expr *IVExpr = S.getIterationVariable(); + const unsigned IVSize = getContext().getTypeSize(IVExpr->getType()); + const bool IVSigned = IVExpr->getType()->hasSignedIntegerRepresentation(); ---------------- There was a problem with indentation, seems to me it is fixed ================ Comment at: lib/CodeGen/CGStmtOpenMP.cpp:2185-2216 @@ -2135,14 +2184,34 @@ }; CGM.getOpenMPRuntime().emitTaskgroupRegion(*this, CodeGen, S.getLocStart()); } void CodeGenFunction::EmitOMPFlushDirective(const OMPFlushDirective &S) { CGM.getOpenMPRuntime().emitFlush(*this, [&]() -> ArrayRef<const Expr *> { if (const auto *FlushClause = S.getSingleClause<OMPFlushClause>()) { return llvm::makeArrayRef(FlushClause->varlist_begin(), FlushClause->varlist_end()); } return llvm::None; }(), S.getLocStart()); } +static std::pair<llvm::Value * /*Chunk*/, OpenMPDistScheduleClauseKind> +emitDistScheduleClause(CodeGenFunction &CGF, const OMPDistributeDirective &S, + bool OuterRegion) { + // Detect the distribute schedule kind and chunk. + auto ScheduleKind = OMPC_DIST_SCHEDULE_unknown; + llvm::Value *Chunk = nullptr; + if (const auto *C = S.getSingleClause<OMPDistScheduleClause>()) { + ScheduleKind = C->getDistScheduleKind(); + if (const auto *Ch = C->getChunkSize()) { + if (auto *ImpRef = cast_or_null<DeclRefExpr>(C->getHelperChunkSize())) { + if (OuterRegion) { + const VarDecl *ImpVar = cast<VarDecl>(ImpRef->getDecl()); + CGF.EmitVarDecl(*ImpVar); + CGF.EmitStoreThroughLValue( + CGF.EmitAnyExpr(Ch), + CGF.MakeAddrLValue(CGF.GetAddrOfLocalVar(ImpVar), + ImpVar->getType())); + } else { + Ch = ImpRef; + } ---------------- I reworked it already, check the code in trunk ================ Comment at: lib/CodeGen/CGStmtOpenMP.cpp:2914 @@ -2713,4 +2913,3 @@ if (NT || TL) { - NumTeamsVal = (NT) ? CGF.EmitScalarExpr(NT->getNumTeams(), - /* IgnoreResultAssign = */ true) : + NumTeamsVal = (NT) ? CGF.EmitScalarExpr(NT->getNumTeams(), true) : NumTeamsVal = CGF.Builder.getInt32(0); ---------------- Comment for 'true' arg? Repository: rL LLVM http://reviews.llvm.org/D17170 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits