[Openmp-commits] [PATCH] D108132: Add implicit map for a list item appears in a reduction clause.

Alexey Bataev via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Aug 17 12:18:16 PDT 2021

ABataev added inline comments.

Comment at: clang/lib/Sema/SemaOpenMP.cpp:19481-19482
     if (VD && DSAS->isThreadPrivate(VD)) {
+      if (NoDiagnose)
+        continue;
       DSAStackTy::DSAVarData DVar = DSAS->getTopDSA(VD, /*FromParent=*/false);
jyu2 wrote:
> ABataev wrote:
> > jyu2 wrote:
> > > ABataev wrote:
> > > > Hmm, should not we still diagnose this case?
> > > The rule is skip the error as well as skip adding implicit map clause.  So that we don't get regression for old code.
> > I think we already have the check for it for the reduction clause, so I think we can skip this check here.
> In general yes.  But not for some special case, please look clang/test/OpenMP/reduction_implicit_map.cpp, in the first test,  if I remove this change the error will be emit.  In CUDA device code, the local variable is  implicitly threat as thridprivate.
> #if defined(CUDA)
> // expected-no-diagnostics
> int foo(int n) {
>   double *e;
>   //no error and no implicit map generated for e[:1]
>   #pragma omp target parallel reduction(+: e[:1])
>     *e=10;
>   ;
>   return 0;
> }
I just was not quite clear, I agree with your previous answer ;)

  rG LLVM Github Monorepo



More information about the Openmp-commits mailing list