[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 Jul 29 05:49:08 PDT 2024


================
@@ -280,75 +361,66 @@ 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((mlir::Value)memberMap);
 
-      mapOp.setMembersIndexAttr(createDenseElementsAttrFromIndices(
-          indices.second, converter.getFirOpBuilder()));
+      Fortran::lower::omp::fillMemberIndices(
+          indices.second.memberPlacementIndices);
+      mapOp.setMembersIndexAttr(
+          Fortran::lower::omp::createDenseElementsAttrFromIndices(
+              indices.second.memberPlacementIndices,
+              converter.getFirOpBuilder()));
     } 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((mlir::Value)memberMap);
----------------
skatrak wrote:

```suggestion
        members.push_back(memberMap.getResult());
```

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


More information about the llvm-branch-commits mailing list