[PATCH] D112292: [Clang][OpenMP] Allow loop iteration var with threadprivate directive

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 22 08:08:12 PDT 2021


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:
> > 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). 
> That is already there but in different in the if statement on line 8657 in old code:
> 
>  DVar.CKind != OMPC_lastprivate)) &
> 
> I just want to merge that into PredetermindCKind.
> 
Can you do it in a separate NFC patch (if this is actually NFC)?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112292/new/

https://reviews.llvm.org/D112292



More information about the cfe-commits mailing list