jdoerfert added inline comments.

================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:1128
+           (A == OMPC_firstprivate && (Data.Attributes == OMPC_lastprivate ||
+                                       Data.Attributes == OMPC_linear)) ||
            (A == OMPC_lastprivate && Data.Attributes == OMPC_firstprivate) ||
----------------
ABataev wrote:
> jdoerfert wrote:
> > ABataev wrote:
> > > cchen wrote:
> > > > ABataev wrote:
> > > > > What is this change for?
> > > > Since now the variable in step expression has been set as implicit 
> > > > firstprivate.
> > > No need to do this, the whole expression must be evaluated before 
> > > entering the parallel region.
> > The standard is not clear on this, e.g., what if the expression has a 
> > side-effect and the loop has 0 iterations. However, evaluating it once in 
> > the beginning seems fine to me, assuming we do not evaluate it later again.
> The standard says: `The linear-step expression must be invariant during the 
> execution of the region that corresponds to the construct.` So, it is ok to 
> evaluate it at the entrance to the region. The only thing that (maybe) 
> required is to check that the expression is really invariant in the analysis 
> phase.
I'll just repeat the under-specified case you seem to have missed while reading 
my comment:

> What if the expression has a side-effect and the loop has 0 iterations.






Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71475



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to