ABataev added inline comments.
================ Comment at: clang/lib/Sema/SemaOpenMP.cpp:8653 ? (DSAStack->hasMutipleLoops() ? OMPC_lastprivate : OMPC_linear) - : OMPC_private; - if (((isOpenMPSimdDirective(DKind) && DVar.CKind != OMPC_unknown && - DVar.CKind != PredeterminedCKind && DVar.RefExpr && - (LangOpts.OpenMP <= 45 || (DVar.CKind != OMPC_lastprivate && - DVar.CKind != OMPC_private))) || - ((isOpenMPWorksharingDirective(DKind) || DKind == OMPD_taskloop || - DKind == OMPD_master_taskloop || - DKind == OMPD_parallel_master_taskloop || - isOpenMPDistributeDirective(DKind)) && - !isOpenMPSimdDirective(DKind) && DVar.CKind != OMPC_unknown && - DVar.CKind != OMPC_private && DVar.CKind != OMPC_lastprivate)) && - (DVar.CKind != OMPC_private || DVar.RefExpr)) { + : DVar.CKind == OMPC_lastprivate ? OMPC_lastprivate + : OMPC_private; ---------------- jyu2 wrote: > ABataev wrote: > > Why need this change? > The rule: > The loop iteration variable in any associated loop of a loop construct is > lastprivate. > > So if there is lastprivate clause, should be predetermined as lastprivate. The patch is for threadprivates, better to do it in a separate patch(or patches). ================ Comment at: clang/lib/Sema/SemaOpenMP.cpp:8662-8667 + if (LangOpts.OpenMP > 45 && isOpenMPSimdDirective(DKind)) { + if (DVar.CKind == OMPC_lastprivate) + PredeterminedCKind = OMPC_lastprivate; + else if (DVar.CKind == OMPC_private) + PredeterminedCKind = OMPC_private; + } ---------------- jyu2 wrote: > ABataev wrote: > > Again, why do we need this? > In the comment: for OpenMP 5.0 and up: > > If a simd construct has just one associated loop, the variable may be listed > in a private, lastprivate or linear. > > The linear part is set on line 8652, there just need to set private and > lastprivate. > > Same here, better to split this change Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D112292/new/ https://reviews.llvm.org/D112292 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits