[PATCH] D145093: Add map info for dereference pointer.

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 2 12:31:34 PST 2023


ABataev added inline comments.


================
Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:7487-7497
+      auto TNext = Next;
+      bool IsVarDerefAssoWithArray = false;
+      if (UO && UO->getOpcode() == UO_Deref)
+        for (; TNext != CE; TNext = std::next(TNext))
+          if (isa<OMPArraySectionExpr>(TNext->getAssociatedExpression()) ||
+              isa<MemberExpr>(TNext->getAssociatedExpression()) ||
+              isa<OMPArrayShapingExpr>(TNext->getAssociatedExpression()) ||
----------------
jyu2 wrote:
> ABataev wrote:
> > jyu2 wrote:
> > > ABataev wrote:
> > > > Why need a loop here? Can you somehow merge analysis for (*p) expression with the pointer subscript analysis?
> > > What about if you have three dereference pointers like (***a)[0:3]  or four pointers...
> > Why you can't iterate through the required components just like for the array subscrit expression?
> Because currently, for unarray operator the map info is skipped following the rule:
> 
> bool IsNonDerefPointer = IsPointer && !UO && !BO && !IsNonContiguous;
> 
> So I need to check if it is dereference to array some how to not skip it.
1. Same problem in Sema too.
2. Can you try to fix it to avoid those loops?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145093



More information about the cfe-commits mailing list