[llvm-branch-commits] [flang] [Flang][OpenMP] Derived type explicit allocatable member mapping (PR #96266)

Sergio Afonso via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Aug 12 08:42:16 PDT 2024


================
@@ -280,75 +340,60 @@ void insertChildMapInfoIntoParent(
       // precedes the children. An alternative, may be to do
       // delayed generation of map info operations from the clauses and
       // organize them first before generation.
-      mapOp->moveAfter(indices.second.back().memberMap);
+      mapOp->moveAfter(indices.second.memberMap.back());
 
-      for (auto memberIndicesData : indices.second)
-        mapOp.getMembersMutable().append(
-            memberIndicesData.memberMap.getResult());
+      for (mlir::omp::MapInfoOp memberMap : indices.second.memberMap)
+        mapOp.getMembersMutable().append(memberMap.getResult());
 
-      mapOp.setMembersIndexAttr(createDenseElementsAttrFromIndices(
-          indices.second, converter.getFirOpBuilder()));
+      mapOp.setMembersIndexAttr(
+          converter.getFirOpBuilder().create2DIntegerArrayAttr(
+              indices.second.memberPlacementIndices));
     } else {
       // NOTE: We take the map type of the first child, this may not
       // be the correct thing to do, however, we shall see. For the moment
       // it allows this to work with enter and exit without causing MLIR
       // verification issues. The more appropriate thing may be to take
       // the "main" map type clause from the directive being used.
-      uint64_t mapType = indices.second[0].memberMap.getMapType().value_or(0);
-
-      // create parent to emplace and bind members
-      mlir::Value origSymbol = converter.getSymbolAddress(*indices.first);
+      uint64_t mapType = indices.second.memberMap[0].getMapType().value_or(0);
 
       llvm::SmallVector<mlir::Value> members;
-      for (OmpMapMemberIndicesData memberIndicesData : indices.second)
-        members.push_back((mlir::Value)memberIndicesData.memberMap);
+      for (mlir::omp::MapInfoOp memberMap : indices.second.memberMap)
+        members.push_back(memberMap.getResult());
+
+      // create parent to emplace and bind members
----------------
skatrak wrote:

```suggestion
      // Create parent to emplace and bind members.
```

https://github.com/llvm/llvm-project/pull/96266


More information about the llvm-branch-commits mailing list