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

Jennifer Yu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 2 11:33:59 PST 2023


jyu2 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()) ||
----------------
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...


================
Comment at: clang/lib/Sema/SemaOpenMP.cpp:2206-2207
             return false;
-
-          if (isa<ArraySubscriptExpr>(EI->getAssociatedExpression()) ||
-              isa<OMPArraySectionExpr>(EI->getAssociatedExpression()) ||
-              isa<MemberExpr>(EI->getAssociatedExpression()) ||
-              isa<OMPArrayShapingExpr>(EI->getAssociatedExpression())) {
-            IsVariableAssociatedWithSection = true;
-            // There is nothing more we need to know about this variable.
-            return true;
+          auto Next = EI;
+          for (; Next != EE; Next = std::next(Next)) {
+            if (isa<ArraySubscriptExpr>(Next->getAssociatedExpression()) ||
----------------
ABataev wrote:
> Why do you need a loop here?
What about if you have three dereference pointers like (***a)[0:3]  or four pointers...


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