[flang-commits] [flang] [Flang][OpenMP] Remove old partially implemented implicit allocatable member mapping from MapInfoFinalization (PR #219434)

via flang-commits flang-commits at lists.llvm.org
Fri Aug 28 03:31:32 PDT 2026


https://github.com/agozillon created https://github.com/llvm/llvm-project/pull/219434

Remove partially complete implicit allocatable map code from MapInfoFinalization, it should no longer be required as the DeclareMapper infrastructure in the frontend handles this. It is currently propping up some odd map cases related to declare mapper that I do not believe are legal.

>From 964dc464b2f6fe4875f01e62089b13ef1899e46c Mon Sep 17 00:00:00 2001
From: agozillon <Andrew.Gozillon at amd.com>
Date: Fri, 28 Aug 2026 04:06:43 -0500
Subject: [PATCH] [Flang][OpenMP] Remove old partially implemented implicit
 allocatable member mapping from MapInfoFinalization

Remove partially complete implicit allocatable map code from MapInfoFinalization, it should
no longer be required as the DeclareMapper infrastructure in the frontend handles this. It is
currently propping up some odd map cases related to declare mapper that I do not believe are
legal.
---
 .../Optimizer/OpenMP/MapInfoFinalization.cpp  | 191 ------------------
 flang/test/Lower/OpenMP/declare-mapper.f90    |  63 ++----
 ...p-map-info-finalization-implicit-field.fir |  92 ---------
 .../omp-map-info-finalization-usm.fir         |  24 ---
 4 files changed, 12 insertions(+), 358 deletions(-)
 delete mode 100644 flang/test/Transforms/omp-map-info-finalization-implicit-field.fir
 delete mode 100644 flang/test/Transforms/omp-map-info-finalization-usm.fir

diff --git a/flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp b/flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp
index 0fdc2e1278589..63f38e60f9d12 100644
--- a/flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp
+++ b/flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp
@@ -1523,197 +1523,6 @@ class MapInfoFinalizationPass
         addImplicitMembersToTarget(op, builder, targetUser);
       });
 
-      // Next, walk `omp.map.info` ops to see if any record members should be
-      // implicitly mapped.
-      func->walk([&](mlir::omp::MapInfoOp op) {
-        mlir::Type underlyingType =
-            fir::unwrapRefType(op.getVarPtr().getType());
-
-        // TODO Test with and support more complicated cases; like arrays for
-        // records, for example.
-        if (!fir::isRecordWithAllocatableMember(underlyingType))
-          return mlir::WalkResult::advance();
-
-        // TODO For now, only consider `omp.target` ops. Other ops that support
-        // `map` clauses will follow later.
-        mlir::omp::TargetOp target =
-            mlir::dyn_cast_if_present<mlir::omp::TargetOp>(
-                getFirstTargetUser(op));
-
-        if (!target)
-          return mlir::WalkResult::advance();
-
-        auto mapClauseOwner =
-            llvm::dyn_cast<mlir::omp::MapClauseOwningOpInterface>(*target);
-
-        int64_t mapVarIdx = mapClauseOwner.getOperandIndexForMap(op);
-        assert(mapVarIdx >= 0 &&
-               mapVarIdx <
-                   static_cast<int64_t>(mapClauseOwner.getMapVars().size()));
-
-        auto argIface =
-            llvm::dyn_cast<mlir::omp::BlockArgOpenMPOpInterface>(*target);
-        // TODO How should `map` block argument that correspond to: `private`,
-        // `use_device_addr`, `use_device_ptr`, be handled?
-        mlir::BlockArgument opBlockArg = argIface.getMapBlockArgs()[mapVarIdx];
-        llvm::SetVector<mlir::Operation *> mapVarForwardSlice;
-        mlir::getForwardSlice(opBlockArg, &mapVarForwardSlice);
-
-        mapVarForwardSlice.remove_if([&](mlir::Operation *sliceOp) {
-          // TODO Support coordinate_of ops.
-          //
-          // TODO Support call ops by recursively examining the forward slice of
-          // the corresponding parameter to the field in the called function.
-          return !mlir::isa<hlfir::DesignateOp>(sliceOp);
-        });
-
-        auto recordType = mlir::cast<fir::RecordType>(underlyingType);
-        llvm::SmallVector<mlir::Value> newMapOpsForFields;
-        llvm::SmallVector<llvm::SmallVector<int64_t>> newMemberIndexPaths;
-
-        // 1) Handle direct top-level allocatable fields.
-        for (auto fieldMemTyPair : recordType.getTypeList()) {
-          auto &field = fieldMemTyPair.first;
-          auto memTy = fieldMemTyPair.second;
-
-          if (!fir::isAllocatableType(memTy))
-            continue;
-
-          bool referenced = llvm::any_of(mapVarForwardSlice, [&](auto *opv) {
-            auto designateOp = mlir::dyn_cast<hlfir::DesignateOp>(opv);
-            return designateOp && designateOp.getComponent() &&
-                   designateOp.getComponent()->strref() == field;
-          });
-          if (!referenced)
-            continue;
-
-          int32_t fieldIdx = recordType.getFieldIndex(field);
-          builder.setInsertionPoint(op);
-          fir::IntOrValue idxConst =
-              mlir::IntegerAttr::get(builder.getI32Type(), fieldIdx);
-          auto fieldCoord = fir::CoordinateOp::create(
-              builder, op.getLoc(), builder.getRefType(memTy), op.getVarPtr(),
-              llvm::SmallVector<fir::IntOrValue, 1>{idxConst});
-          int64_t fieldIdx64 = static_cast<int64_t>(fieldIdx);
-          llvm::SmallVector<int64_t, 1> idxPath{fieldIdx64};
-          appendMemberMapIfNew(op, builder, op.getLoc(), fieldCoord, idxPath,
-                               field, newMapOpsForFields, newMemberIndexPaths);
-        }
-
-        // Handle nested allocatable fields along any component chain
-        // referenced in the region via HLFIR designates.
-        llvm::SmallVector<llvm::SmallVector<int64_t>> seenIndexPaths;
-        for (mlir::Operation *sliceOp : mapVarForwardSlice) {
-          auto designateOp = mlir::dyn_cast<hlfir::DesignateOp>(sliceOp);
-          if (!designateOp || !designateOp.getComponent())
-            continue;
-          llvm::SmallVector<llvm::StringRef> compPathReversed;
-          compPathReversed.push_back(designateOp.getComponent()->strref());
-          mlir::Value curBase = designateOp.getMemref();
-          bool rootedAtMapArg = false;
-          while (true) {
-            if (auto parentDes = curBase.getDefiningOp<hlfir::DesignateOp>()) {
-              if (!parentDes.getComponent())
-                break;
-              compPathReversed.push_back(parentDes.getComponent()->strref());
-              curBase = parentDes.getMemref();
-              continue;
-            }
-            if (auto decl = curBase.getDefiningOp<hlfir::DeclareOp>()) {
-              if (auto barg =
-                      mlir::dyn_cast<mlir::BlockArgument>(decl.getMemref()))
-                rootedAtMapArg = (barg == opBlockArg);
-            } else if (auto blockArg =
-                           mlir::dyn_cast_or_null<mlir::BlockArgument>(
-                               curBase)) {
-              rootedAtMapArg = (blockArg == opBlockArg);
-            }
-            break;
-          }
-          // Only process nested paths (2+ components). Single-component paths
-          // for direct fields are handled above.
-          if (!rootedAtMapArg || compPathReversed.size() < 2)
-            continue;
-          builder.setInsertionPoint(op);
-          llvm::SmallVector<int64_t> indexPath;
-          mlir::Type curTy = underlyingType;
-          mlir::Value coordRef = op.getVarPtr();
-          bool validPath = true;
-          for (llvm::StringRef compName : llvm::reverse(compPathReversed)) {
-            auto recTy = mlir::dyn_cast<fir::RecordType>(curTy);
-            if (!recTy) {
-              validPath = false;
-              break;
-            }
-            int32_t idx = recTy.getFieldIndex(compName);
-            if (idx < 0) {
-              validPath = false;
-              break;
-            }
-            indexPath.push_back(idx);
-            mlir::Type memTy = recTy.getType(idx);
-            fir::IntOrValue idxConst =
-                mlir::IntegerAttr::get(builder.getI32Type(), idx);
-            coordRef = fir::CoordinateOp::create(
-                builder, op.getLoc(), builder.getRefType(memTy), coordRef,
-                llvm::SmallVector<fir::IntOrValue, 1>{idxConst});
-            curTy = memTy;
-          }
-          if (!validPath)
-            continue;
-          if (auto finalRefTy =
-                  mlir::dyn_cast<fir::ReferenceType>(coordRef.getType())) {
-            mlir::Type eleTy = finalRefTy.getElementType();
-            if (fir::isAllocatableType(eleTy)) {
-              if (!containsPath(seenIndexPaths, indexPath)) {
-                seenIndexPaths.emplace_back(indexPath.begin(), indexPath.end());
-                appendMemberMapIfNew(op, builder, op.getLoc(), coordRef,
-                                     indexPath, compPathReversed.front(),
-                                     newMapOpsForFields, newMemberIndexPaths);
-              }
-            }
-          }
-        }
-
-        if (newMapOpsForFields.empty())
-          return mlir::WalkResult::advance();
-
-        // Deduplicate by index path to avoid emitting duplicate members for
-        // the same component. Use a set-based key to keep this near O(n).
-        llvm::SmallVector<mlir::Value> dedupMapOps;
-        llvm::SmallVector<llvm::SmallVector<int64_t>> dedupIndexPaths;
-        llvm::StringSet<> seenKeys;
-        for (auto [i, mapOp] : llvm::enumerate(newMapOpsForFields)) {
-          const auto &path = newMemberIndexPaths[i];
-          llvm::SmallString<64> key;
-          buildPathKey(path, key);
-          if (seenKeys.contains(key))
-            continue;
-          seenKeys.insert(key);
-          dedupMapOps.push_back(mapOp);
-          dedupIndexPaths.emplace_back(path.begin(), path.end());
-        }
-        op.getMembersMutable().append(dedupMapOps);
-        llvm::SmallVector<llvm::SmallVector<int64_t>> newMemberIndices;
-        if (mlir::ArrayAttr oldAttr = op.getMembersIndexAttr())
-          for (mlir::Attribute indexList : oldAttr) {
-            llvm::SmallVector<int64_t> listVec;
-
-            for (mlir::Attribute index : mlir::cast<mlir::ArrayAttr>(indexList))
-              listVec.push_back(mlir::cast<mlir::IntegerAttr>(index).getInt());
-
-            newMemberIndices.emplace_back(std::move(listVec));
-          }
-        for (auto &path : dedupIndexPaths)
-          newMemberIndices.emplace_back(path);
-
-        op.setMembersIndexAttr(builder.create2DI64ArrayAttr(newMemberIndices));
-        // Set to partial map only if there is no user-defined mapper.
-        op.setPartialMap(op.getMapperIdAttr() == nullptr);
-
-        return mlir::WalkResult::advance();
-      });
-
       // Expand type(C_PTR) only when unified_shared_memory is required,
       // to ensure device-visible pointer size/behavior in USM scenarios
       // without changing default expectations elsewhere.
diff --git a/flang/test/Lower/OpenMP/declare-mapper.f90 b/flang/test/Lower/OpenMP/declare-mapper.f90
index c10bcc5da3f2d..51b155ea31f48 100644
--- a/flang/test/Lower/OpenMP/declare-mapper.f90
+++ b/flang/test/Lower/OpenMP/declare-mapper.f90
@@ -6,15 +6,14 @@
 ! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=50 %t/omp-declare-mapper-3.f90 -o - | FileCheck %t/omp-declare-mapper-3.f90
 ! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=50 %t/omp-declare-mapper-4.f90 -o - | FileCheck %t/omp-declare-mapper-4.f90
 ! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=50 %t/omp-declare-mapper-5.f90 -o - | FileCheck %t/omp-declare-mapper-5.f90
-! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=50 %t/omp-declare-mapper-6.f90 -o - | FileCheck %t/omp-declare-mapper-6.f90
+! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=50 -module-dir %t %t/omp-declare-mapper-6.mod.f90 -o - >/dev/null
+! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=50 -J %t %t/omp-declare-mapper-6.use.f90 -o - | FileCheck %t/omp-declare-mapper-6.use.f90
 ! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=50 -module-dir %t %t/omp-declare-mapper-7.mod.f90 -o - >/dev/null
 ! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=50 -J %t %t/omp-declare-mapper-7.use.f90 -o - | FileCheck %t/omp-declare-mapper-7.use.f90
-! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=50 -module-dir %t %t/omp-declare-mapper-8.mod.f90 -o - >/dev/null
-! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=50 -J %t %t/omp-declare-mapper-8.use.f90 -o - | FileCheck %t/omp-declare-mapper-8.use.f90
-! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=52 %t/omp-declare-mapper-9.f90 -o - | FileCheck %t/omp-declare-mapper-9.f90
+! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=52 %t/omp-declare-mapper-8.f90 -o - | FileCheck %t/omp-declare-mapper-8.f90
+! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=50 %t/omp-declare-mapper-9.f90 -o - | FileCheck %t/omp-declare-mapper-9.f90
 ! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=50 %t/omp-declare-mapper-10.f90 -o - | FileCheck %t/omp-declare-mapper-10.f90
 ! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=50 %t/omp-declare-mapper-11.f90 -o - | FileCheck %t/omp-declare-mapper-11.f90
-! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=50 %t/omp-declare-mapper-12.f90 -o - | FileCheck %t/omp-declare-mapper-12.f90
 
 !--- omp-declare-mapper-1.f90
 subroutine declare_mapper_1
@@ -274,45 +273,7 @@ subroutine use_inner()
    end subroutine
 end program declare_mapper_5
 
-!--- omp-declare-mapper-6.f90
-subroutine declare_mapper_nested_parent
-  type :: inner_t
-    real, allocatable :: deep_arr(:)
-  end type inner_t
-
-  type, abstract :: base_t
-    real, allocatable :: base_arr(:)
-    type(inner_t) :: inner
-  end type base_t
-
-  type, extends(base_t) :: real_t
-    real, allocatable :: real_arr(:)
-  end type real_t
-
-  !$omp declare mapper (custommapper : real_t :: t) map(tofrom: t%base_arr, t%real_arr)
-  ! CHECK: omp.declare_mapper @{{.*custommapper}}
-  ! CHECK-DAG: omp.map.info {{.*}} name("t%base_t%base_arr")
-  ! CHECK-DAG: omp.map.info {{.*}} name("t%real_arr")
-  ! CHECK: omp.declare_mapper.info
-
-  type(real_t) :: r
-
-  allocate(r%base_arr(10))
-  allocate(r%inner%deep_arr(10))
-  allocate(r%real_arr(10))
-  r%base_arr = 1.0
-  r%inner%deep_arr = 4.0
-  r%real_arr = 0.0
-
-  ! Check implicit maps for deep nested allocatable payloads not covered by mapper
-  ! CHECK-DAG: omp.map.info {{.*}} name("r.deep_arr.implicit_map")
-  ! CHECK: omp.target kernel_type(generic)
-  !$omp target map(mapper(custommapper), tofrom: r)
-    r%real_arr = r%base_arr(1) + r%inner%deep_arr(1)
-  !$omp end target
-end subroutine declare_mapper_nested_parent
-
-!--- omp-declare-mapper-7.mod.f90
+!--- omp-declare-mapper-6.mod.f90
 ! Module with DECLARE MAPPER to be compiled separately
 module m_mod
   implicit none
@@ -322,7 +283,7 @@ module m_mod
   !$omp declare mapper(mymap : mty :: v) map(tofrom: v%x)
 end module m_mod
 
-!--- omp-declare-mapper-7.use.f90
+!--- omp-declare-mapper-6.use.f90
 ! Consumer program that USEs the module and applies the mapper by name.
 ! CHECK: %{{.*}} = omp.map.info {{.*}} mapper(@{{.*mymap}}) name("a")
 program use_module_mapper
@@ -334,7 +295,7 @@ program use_module_mapper
   !$omp end target
 end program use_module_mapper
 
-!--- omp-declare-mapper-8.mod.f90
+!--- omp-declare-mapper-7.mod.f90
 ! Module with a default DECLARE MAPPER to be compiled separately.
 module default_mapper_mod
   implicit none
@@ -344,7 +305,7 @@ module default_mapper_mod
   !$omp declare mapper(dtype :: v) map(tofrom: v%x)
 end module default_mapper_mod
 
-!--- omp-declare-mapper-8.use.f90
+!--- omp-declare-mapper-7.use.f90
 ! Consumer program that USEs the module and relies on the default mapper.
 ! CHECK: omp.declare_mapper @{{.*dtype_omp_default_mapper}} : !fir.type<_QMdefault_mapper_modTdtype{x:i32}>
 ! CHECK: %{{.*}} = omp.map.info {{.*}} map_clauses(tofrom) {{.*}} mapper(@{{.*dtype_omp_default_mapper}}) name("a")
@@ -367,7 +328,7 @@ program use_module_default_mapper
   !$omp end target
 end program use_module_default_mapper
 
-!--- omp-declare-mapper-9.f90
+!--- omp-declare-mapper-8.f90
 ! Test mapper usage in target update to/from clauses
 program target_update_mapper
   type :: typ
@@ -400,7 +361,7 @@ program target_update_mapper
 
 end program target_update_mapper
 
-!--- omp-declare-mapper-10.f90
+!--- omp-declare-mapper-9.f90
 ! Test that default mapper is applied only to the matching type (dtype_a) and not to dtype_b
 subroutine declare_mapper_10
     type dtype_a
@@ -434,7 +395,7 @@ subroutine declare_mapper_10
     !$omp target enter data map(to: dtype, var_a, var_b, dtype2)
 end subroutine
 
-!--- omp-declare-mapper-11.f90
+!--- omp-declare-mapper-10.f90
 ! Test that named mapper overrides default mapper when explicitly specified
 subroutine declare_mapper_11
     type dtype_a
@@ -470,7 +431,7 @@ subroutine declare_mapper_11
     !$omp target enter data map(mapper(testing), to: dtype, var_a, var_b, dtype2)
 end subroutine
 
-!--- omp-declare-mapper-12.f90
+!--- omp-declare-mapper-11.f90
 ! Test multiple types with different mappers - each type gets its appropriate mapper
 subroutine declare_mapper_12
     type dtype_a
diff --git a/flang/test/Transforms/omp-map-info-finalization-implicit-field.fir b/flang/test/Transforms/omp-map-info-finalization-implicit-field.fir
deleted file mode 100644
index fc26cd9477377..0000000000000
--- a/flang/test/Transforms/omp-map-info-finalization-implicit-field.fir
+++ /dev/null
@@ -1,92 +0,0 @@
-// Tests that we implicitly map alloctable fields of a record when referenced in
-// a target region.
-
-// RUN: fir-opt --split-input-file --omp-map-info-finalization %s | FileCheck %s
-
-!record_t = !fir.type<_QFTrecord_t{
-  not_to_implicitly_map:
-    !fir.box<!fir.heap<!fir.array<?xf32>>>,
-  to_implicitly_map:
-    !fir.box<!fir.heap<!fir.array<?xf32>>>
-}>
-
-fir.global internal @_QFEdst_record : !record_t {
-  %0 = fir.undefined !record_t
-  fir.has_value %0 : !record_t
-}
-
-omp.declare_mapper @record_mapper : !record_t {
-^bb0(%arg0: !fir.ref<!record_t>):
-  %0 = omp.map.info var_ptr(%arg0: !fir.ref<!record_t>, !record_t) map_clauses(implicit, tofrom) capture(ByRef) -> !fir.ref<!record_t>
-  omp.declare_mapper.info map_entries(%0: !fir.ref<!record_t>)
-}
-
-func.func @_QQmain() {
-  %6 = fir.address_of(@_QFEdst_record) : !fir.ref<!record_t>
-  %7:2 = hlfir.declare %6 {uniq_name = "_QFEdst_record"} : (!fir.ref<!record_t>) -> (!fir.ref<!record_t>, !fir.ref<!record_t>)
-  %16 = omp.map.info var_ptr(%7#1 : !fir.ref<!record_t>, !record_t) map_clauses(implicit, tofrom) capture(ByRef) name("dst_record") -> !fir.ref<!record_t>
-  %17 = omp.map.info var_ptr(%7#1 : !fir.ref<!record_t>, !record_t) map_clauses(implicit, tofrom) capture(ByRef) mapper(@record_mapper) name("dst_record_with_mapper") -> !fir.ref<!record_t>
-  omp.target kernel_type(generic) map_entries(%16 -> %arg0, %17 -> %arg1 : !fir.ref<!record_t>, !fir.ref<!record_t>) {
-    %20:2 = hlfir.declare %arg0 {uniq_name = "_QFEdst_record"} : (!fir.ref<!record_t>) -> (!fir.ref<!record_t>, !fir.ref<!record_t>)
-    %21:2 = hlfir.declare %arg1 {uniq_name = "_QFEdst_record"} : (!fir.ref<!record_t>) -> (!fir.ref<!record_t>, !fir.ref<!record_t>)
-
-    %23 = hlfir.designate %20#0{"to_implicitly_map"}   {fortran_attrs = #fir.var_attrs<allocatable>} : (!fir.ref<!record_t>) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
-
-    %24 = hlfir.designate %21#0{"to_implicitly_map"}   {fortran_attrs = #fir.var_attrs<allocatable>} : (!fir.ref<!record_t>) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
-    omp.terminator
-  }
-  return
-}
-
-// CHECK: %[[RECORD_DECL:.*]]:2 = hlfir.declare %0 {uniq_name = "_QFEdst_record"}
-// CHECK: %[[FIELD_COORD:.*]] = fir.coordinate_of %[[RECORD_DECL]]#1, to_implicitly_map
-
-// CHECK: %[[UPPER_BOUND:.*]] = arith.subi %{{.*}}#1, %{{c1.*}} : index
-
-// CHECK: %[[BOUNDS:.*]] = omp.map.bounds
-// CHECK-SAME: lower_bound(%{{c0.*}} : index) upper_bound(%[[UPPER_BOUND]] : index)
-// CHECK-SAME: extent(%{{.*}}#1 : index) stride(%{{.*}}#2 : index)
-// CHECK-SAME: start_idx(%{{.*}}#0 : index) stride_in_bytes(true)
-
-// CHECK: %[[BASE_ADDR:.*]] = fir.box_offset %[[FIELD_COORD]] base_addr
-// CHECK: %[[FIELD_BASE_ADDR_MAP:.*]] = omp.map.info var_ptr(
-// CHECK-SAME: %[[FIELD_COORD]] : {{.*}}) map_clauses(
-// CHECK-SAME: implicit, tofrom) capture(ByRef) var_ptr_ptr(
-// CHECK-SAME: %[[BASE_ADDR]] : {{.*}}) bounds(
-// CHECK-SAME: %[[BOUNDS]])
-
-// CHECK: %[[FIELD_MAP:.*]] = omp.map.info var_ptr(
-// CHECK-SAME: %[[FIELD_COORD]] : {{.*}}) map_clauses(
-// CHECK-SAME: always, implicit, to) capture(ByRef)
-// CHECK-SAME: name("dst_record.to_implicitly_map.implicit_map") ->
-
-// CHECK: %[[ATTACH_MAP:.*]] = omp.map.info var_ptr(
-// CHECK-SAME: %[[FIELD_COORD]] : {{.*}}) map_clauses(
-// CHECK-SAME: attach, ref_ptr, ref_ptee) capture(ByRef)
-// CHECK-SAME: var_ptr_ptr(%[[BASE_ADDR]] : {{.*}}
-
-// CHECK: %[[RECORD_MAP:.*]] = omp.map.info var_ptr(
-// CHECK-SAME: %[[RECORD_DECL]]#1 : {{.*}}) map_clauses(
-// CHECK-SAME: implicit, tofrom) capture(ByRef) members(
-// CHECK-SAME: %[[FIELD_MAP]], %[[FIELD_BASE_ADDR_MAP]] :
-// CHECK-SAME: [1], [1, 0] : {{.*}}) name("dst_record")
-// CHECK-SAME: partial_map(true) -> {{.*}}>
-
-// Verify map ops when using a mapper:
-// Implicit field mapping is the same as for the non-mapper case.
-// CHECK: omp.map.info
-// CHECK: omp.map.info
-// CHECK: omp.map.info
-
-// Verify that partial-map is not set if the map info op uses a user-defined (or
-// compiler-emitted) mapper.
-// CHECK: %[[RECORD_MAP_MAPPER:.*]] = omp.map.info var_ptr(
-// CHECK-SAME: %[[RECORD_DECL]]#1 : {{.*}}) map_clauses(
-// CHECK-SAME: implicit, tofrom) capture(ByRef) mapper(@record_mapper)
-// CHECK-SAME: members(%{{.*}}, %{{.*}} : [1], [1, 0] : {{.*}}) name("dst_record_with_mapper") -> {{.*}}>
-
-// CHECK: omp.target kernel_type(generic) map_entries(
-// CHECK-SAME: %[[RECORD_MAP]] -> %{{[^[:space:]]+}},
-// CHECK-SAME: %[[FIELD_MAP]] -> %{{[^[:space:]]+}},
-// CHECK-SAME: %[[FIELD_BASE_ADDR_MAP]] -> %{{[^[:space:]]+}}
-// CHECK-SAME: : {{.*}})
diff --git a/flang/test/Transforms/omp-map-info-finalization-usm.fir b/flang/test/Transforms/omp-map-info-finalization-usm.fir
deleted file mode 100644
index dd1d477323ca1..0000000000000
--- a/flang/test/Transforms/omp-map-info-finalization-usm.fir
+++ /dev/null
@@ -1,24 +0,0 @@
-// RUN: fir-opt --split-input-file --omp-map-info-finalization %s | FileCheck %s
-
-// Test that the 'close' map flag is cleared from member maps if the parent map
-// (derived type) does not have the 'close' flag. This typically happens in
-// Unified Shared Memory (USM) mode where the parent is in USM (no close) but
-// members (like descriptors) might have been initially tagged with close.
-
-module attributes {omp.requires = #omp<clause_requires unified_shared_memory>} {
-  func.func @test_usm_close_flag_cleanup(%arg0: !fir.ref<!fir.type<t{a:!fir.box<!fir.heap<!fir.array<?xf32>>>}>>) {
-    %map = omp.map.info var_ptr(%arg0 : !fir.ref<!fir.type<t{a:!fir.box<!fir.heap<!fir.array<?xf32>>>}>>, !fir.type<t{a:!fir.box<!fir.heap<!fir.array<?xf32>>>}>) map_clauses(to) capture(ByRef) name("parent") -> !fir.ref<!fir.type<t{a:!fir.box<!fir.heap<!fir.array<?xf32>>>}>>
-
-    omp.target kernel_type(generic) map_entries(%map -> %arg1 : !fir.ref<!fir.type<t{a:!fir.box<!fir.heap<!fir.array<?xf32>>>}>>) {
-      // Simulate usage to trigger implicit map addition
-      %1 = hlfir.designate %arg1{"a"} : (!fir.ref<!fir.type<t{a:!fir.box<!fir.heap<!fir.array<?xf32>>>}>>) -> !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>>
-      omp.terminator
-    }
-    return
-  }
-}
-
-// CHECK-LABEL: func.func @test_usm_close_flag_cleanup
-// CHECK: %[[MEMBER:.*]] = omp.map.info {{.*}} map_clauses(always, to) {{.*}} name("parent.a.implicit_map")
-// CHECK: %[[PARENT:.*]] = omp.map.info {{.*}} map_clauses(to) {{.*}} members(%[[MEMBER]], {{.*}}) name("parent") partial_map(true)
-// CHECK-NOT: close



More information about the flang-commits mailing list