Skip to content

Commit edeb77b

Browse files
committed
[Flang][OpenMP] Update MapInfoFinalization to use BlockArgs Interface and modify use_device_ptr/addr to be order independent
This patch primarily updates the MapInfoFinalization pass to utilise the BlockArgument interface. It also shuffles newly added arguments the MapInfoFinalization passes to the end of the BlockArg/Relevant MapInfo lists, instead of one prior to the owning descriptor type. During this it was noted that the use_device_ptr/addr handling of target data was a little bit too order dependent so I've attempted to make it less so, as we cannot depend on argument ordering to be the same as Fortran for any future frontends.
1 parent 37832d5 commit edeb77b

File tree

10 files changed

+201
-115
lines changed

10 files changed

+201
-115
lines changed

flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp

Lines changed: 61 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -125,61 +125,82 @@ class MapInfoFinalizationPass
125125
// TODO: map the addendum segment of the descriptor, similarly to the
126126
// above base address/data pointer member.
127127

128-
auto addOperands = [&](mlir::OperandRange &operandsArr,
129-
mlir::MutableOperandRange &mutableOpRange,
130-
auto directiveOp) {
131-
llvm::SmallVector<mlir::Value> newMapOps;
132-
for (size_t i = 0; i < operandsArr.size(); ++i) {
133-
if (operandsArr[i] == op) {
134-
// Push new implicit maps generated for the descriptor.
135-
newMapOps.push_back(baseAddr);
128+
mlir::omp::MapInfoOp newDescParentMapOp =
129+
builder.create<mlir::omp::MapInfoOp>(
130+
op->getLoc(), op.getResult().getType(), descriptor,
131+
mlir::TypeAttr::get(fir::unwrapRefType(descriptor.getType())),
132+
/*varPtrPtr=*/mlir::Value{},
133+
/*members=*/mlir::SmallVector<mlir::Value>{baseAddr},
134+
/*members_index=*/
135+
mlir::DenseIntElementsAttr::get(
136+
mlir::VectorType::get(
137+
llvm::ArrayRef<int64_t>({1, 1}),
138+
mlir::IntegerType::get(builder.getContext(), 32)),
139+
llvm::ArrayRef<int32_t>({0})),
140+
/*bounds=*/mlir::SmallVector<mlir::Value>{},
141+
builder.getIntegerAttr(builder.getIntegerType(64, false),
142+
op.getMapType().value()),
143+
op.getMapCaptureTypeAttr(), op.getNameAttr(),
144+
op.getPartialMapAttr());
145+
op.replaceAllUsesWith(newDescParentMapOp.getResult());
146+
op->erase();
136147

137-
// for TargetOp's which have IsolatedFromAbove we must align the
138-
// new additional map operand with an appropriate BlockArgument,
139-
// as the printing and later processing currently requires a 1:1
140-
// mapping of BlockArgs to MapInfoOp's at the same placement in
141-
// each array (BlockArgs and MapOperands).
142-
if (directiveOp) {
143-
directiveOp.getRegion().insertArgument(i, baseAddr.getType(), loc);
148+
auto addOperands = [&](mlir::OperandRange &mapVarsArr,
149+
mlir::MutableOperandRange &mutableOpRange,
150+
mlir::Operation *directiveOp,
151+
mlir::omp::MapInfoOp newDesc,
152+
unsigned blockArgInsertIndex = 0,
153+
bool insertBlockArgs = true) {
154+
if (llvm::is_contained(mapVarsArr, newDesc.getResult())) {
155+
llvm::SmallVector<mlir::Value> newMapOps{mapVarsArr};
156+
for (auto mapMember : newDesc.getMembers()) {
157+
if (!llvm::is_contained(mapVarsArr, mapMember)) {
158+
newMapOps.push_back(mapMember);
159+
if (directiveOp && insertBlockArgs) {
160+
directiveOp->getRegion(0).insertArgument(
161+
blockArgInsertIndex, mapMember.getType(), mapMember.getLoc());
162+
}
163+
blockArgInsertIndex++;
144164
}
145165
}
146-
newMapOps.push_back(operandsArr[i]);
166+
mutableOpRange.assign(newMapOps);
147167
}
148-
mutableOpRange.assign(newMapOps);
149168
};
169+
170+
auto argIface =
171+
llvm::dyn_cast<mlir::omp::BlockArgOpenMPOpInterface>(target);
172+
150173
if (auto mapClauseOwner =
151174
llvm::dyn_cast<mlir::omp::MapClauseOwningOpInterface>(target)) {
152-
mlir::OperandRange mapOperandsArr = mapClauseOwner.getMapVars();
175+
mlir::OperandRange mapVarsArr = mapClauseOwner.getMapVars();
153176
mlir::MutableOperandRange mapMutableOpRange =
154177
mapClauseOwner.getMapVarsMutable();
155-
mlir::omp::TargetOp targetOp =
156-
llvm::dyn_cast<mlir::omp::TargetOp>(target);
157-
addOperands(mapOperandsArr, mapMutableOpRange, targetOp);
178+
unsigned blockArgInsertIndex =
179+
argIface
180+
? argIface.getMapBlockArgsStart() + argIface.numMapBlockArgs()
181+
: 0;
182+
addOperands(mapVarsArr, mapMutableOpRange, argIface.getOperation(),
183+
newDescParentMapOp, blockArgInsertIndex,
184+
!llvm::isa<mlir::omp::TargetDataOp>(target));
158185
}
186+
159187
if (auto targetDataOp = llvm::dyn_cast<mlir::omp::TargetDataOp>(target)) {
160188
mlir::OperandRange useDevAddrArr = targetDataOp.getUseDeviceAddrVars();
161189
mlir::MutableOperandRange useDevAddrMutableOpRange =
162190
targetDataOp.getUseDeviceAddrVarsMutable();
163-
addOperands(useDevAddrArr, useDevAddrMutableOpRange, targetDataOp);
164-
}
191+
addOperands(useDevAddrArr, useDevAddrMutableOpRange, target,
192+
newDescParentMapOp,
193+
argIface.getUseDeviceAddrBlockArgsStart() +
194+
argIface.numUseDeviceAddrBlockArgs());
165195

166-
mlir::Value newDescParentMapOp = builder.create<mlir::omp::MapInfoOp>(
167-
op->getLoc(), op.getResult().getType(), descriptor,
168-
mlir::TypeAttr::get(fir::unwrapRefType(descriptor.getType())),
169-
/*varPtrPtr=*/mlir::Value{},
170-
/*members=*/mlir::SmallVector<mlir::Value>{baseAddr},
171-
/*members_index=*/
172-
mlir::DenseIntElementsAttr::get(
173-
mlir::VectorType::get(
174-
llvm::ArrayRef<int64_t>({1, 1}),
175-
mlir::IntegerType::get(builder.getContext(), 32)),
176-
llvm::ArrayRef<int32_t>({0})),
177-
/*bounds=*/mlir::SmallVector<mlir::Value>{},
178-
builder.getIntegerAttr(builder.getIntegerType(64, false),
179-
op.getMapType().value()),
180-
op.getMapCaptureTypeAttr(), op.getNameAttr(), op.getPartialMapAttr());
181-
op.replaceAllUsesWith(newDescParentMapOp);
182-
op->erase();
196+
mlir::OperandRange useDevPtrArr = targetDataOp.getUseDevicePtrVars();
197+
mlir::MutableOperandRange useDevPtrMutableOpRange =
198+
targetDataOp.getUseDevicePtrVarsMutable();
199+
addOperands(useDevPtrArr, useDevPtrMutableOpRange, target,
200+
newDescParentMapOp,
201+
argIface.getUseDevicePtrBlockArgsStart() +
202+
argIface.numUseDevicePtrBlockArgs());
203+
}
183204
}
184205

185206
// We add all mapped record members not directly used in the target region

flang/test/Lower/OpenMP/allocatable-map.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
!HLFIRDIALECT: %[[BOX_OFF:.*]] = fir.box_offset %[[POINTER]]#1 base_addr : (!fir.ref<!fir.box<!fir.ptr<i32>>>) -> !fir.llvm_ptr<!fir.ref<i32>>
55
!HLFIRDIALECT: %[[POINTER_MAP_MEMBER:.*]] = omp.map.info var_ptr(%[[POINTER]]#1 : !fir.ref<!fir.box<!fir.ptr<i32>>>, i32) var_ptr_ptr(%[[BOX_OFF]] : !fir.llvm_ptr<!fir.ref<i32>>) map_clauses(tofrom) capture(ByRef) -> !fir.llvm_ptr<!fir.ref<i32>> {name = ""}
66
!HLFIRDIALECT: %[[POINTER_MAP:.*]] = omp.map.info var_ptr(%[[POINTER]]#1 : !fir.ref<!fir.box<!fir.ptr<i32>>>, !fir.box<!fir.ptr<i32>>) map_clauses(tofrom) capture(ByRef) members(%[[POINTER_MAP_MEMBER]] : [0] : !fir.llvm_ptr<!fir.ref<i32>>) -> !fir.ref<!fir.box<!fir.ptr<i32>>> {name = "point"}
7-
!HLFIRDIALECT: omp.target map_entries(%[[POINTER_MAP_MEMBER]] -> {{.*}}, %[[POINTER_MAP]] -> {{.*}} : !fir.llvm_ptr<!fir.ref<i32>>, !fir.ref<!fir.box<!fir.ptr<i32>>>) {
7+
!HLFIRDIALECT: omp.target map_entries(%[[POINTER_MAP]] -> {{.*}}, %[[POINTER_MAP_MEMBER]] -> {{.*}} : !fir.ref<!fir.box<!fir.ptr<i32>>>, !fir.llvm_ptr<!fir.ref<i32>>) {
88
subroutine pointer_routine()
99
integer, pointer :: point
1010
!$omp target map(tofrom:point)

flang/test/Lower/OpenMP/array-bounds.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module assumed_array_routines
5353
!HOST: %[[VAR_PTR_PTR:.*]] = fir.box_offset %0 base_addr : (!fir.ref<!fir.box<!fir.array<?xi32>>>) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>
5454
!HOST: %[[MAP_INFO_MEMBER:.*]] = omp.map.info var_ptr(%[[INTERMEDIATE_ALLOCA]] : !fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.array<?xi32>) var_ptr_ptr(%[[VAR_PTR_PTR]] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>> {name = ""}
5555
!HOST: %[[MAP:.*]] = omp.map.info var_ptr(%[[INTERMEDIATE_ALLOCA]] : !fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.box<!fir.array<?xi32>>) map_clauses(tofrom) capture(ByRef) members(%[[MAP_INFO_MEMBER]] : [0] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) -> !fir.ref<!fir.array<?xi32>> {name = "arr_read_write(2:5)"}
56-
!HOST: omp.target map_entries(%[[MAP_INFO_MEMBER]] -> %{{.*}}, %[[MAP]] -> %{{.*}}, {{.*}} -> {{.*}} : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, !fir.ref<!fir.array<?xi32>>, !fir.ref<i32>) {
56+
!HOST: omp.target map_entries(%[[MAP]] -> %{{.*}}, {{.*}} -> {{.*}}, %[[MAP_INFO_MEMBER]] -> %{{.*}} : !fir.ref<!fir.array<?xi32>>, !fir.ref<i32>, !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) {
5757
subroutine assumed_shape_array(arr_read_write)
5858
integer, intent(inout) :: arr_read_write(:)
5959

flang/test/Lower/OpenMP/target.f90

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,9 @@ subroutine omp_target_device_addr
528528
!CHECK: %[[MAP:.*]] = omp.map.info var_ptr({{.*}} : !fir.ref<!fir.box<!fir.ptr<i32>>>, !fir.box<!fir.ptr<i32>>) map_clauses(tofrom) capture(ByRef) members(%[[MAP_MEMBERS]] : [0] : !fir.llvm_ptr<!fir.ref<i32>>) -> !fir.ref<!fir.box<!fir.ptr<i32>>> {name = "a"}
529529
!CHECK: %[[DEV_ADDR_MEMBERS:.*]] = omp.map.info var_ptr({{.*}} : !fir.ref<!fir.box<!fir.ptr<i32>>>, i32) var_ptr_ptr({{.*}} : !fir.llvm_ptr<!fir.ref<i32>>) map_clauses(tofrom) capture(ByRef) -> !fir.llvm_ptr<!fir.ref<i32>> {name = ""}
530530
!CHECK: %[[DEV_ADDR:.*]] = omp.map.info var_ptr({{.*}} : !fir.ref<!fir.box<!fir.ptr<i32>>>, !fir.box<!fir.ptr<i32>>) map_clauses(tofrom) capture(ByRef) members(%[[DEV_ADDR_MEMBERS]] : [0] : !fir.llvm_ptr<!fir.ref<i32>>) -> !fir.ref<!fir.box<!fir.ptr<i32>>> {name = "a"}
531-
!CHECK: omp.target_data map_entries(%[[MAP_MEMBERS]], %[[MAP]] : {{.*}}) use_device_addr(%[[DEV_ADDR_MEMBERS]] -> %[[ARG_0:.*]], %[[DEV_ADDR]] -> %[[ARG_1:.*]] : !fir.llvm_ptr<!fir.ref<i32>>, !fir.ref<!fir.box<!fir.ptr<i32>>>) {
531+
!CHECK: omp.target_data map_entries(%[[MAP]], %[[MAP_MEMBERS]] : {{.*}}) use_device_addr(%[[DEV_ADDR]] -> %[[ARG_0:.*]], %[[DEV_ADDR_MEMBERS]] -> %[[ARG_1:.*]] : !fir.ref<!fir.box<!fir.ptr<i32>>>, !fir.llvm_ptr<!fir.ref<i32>>) {
532532
!$omp target data map(tofrom: a) use_device_addr(a)
533-
!CHECK: %[[VAL_1_DECL:.*]]:2 = hlfir.declare %[[ARG_1]] {fortran_attrs = #fir.var_attrs<pointer>, uniq_name = "_QFomp_target_device_addrEa"} : (!fir.ref<!fir.box<!fir.ptr<i32>>>) -> (!fir.ref<!fir.box<!fir.ptr<i32>>>, !fir.ref<!fir.box<!fir.ptr<i32>>>)
533+
!CHECK: %[[VAL_1_DECL:.*]]:2 = hlfir.declare %[[ARG_0]] {fortran_attrs = #fir.var_attrs<pointer>, uniq_name = "_QFomp_target_device_addrEa"} : (!fir.ref<!fir.box<!fir.ptr<i32>>>) -> (!fir.ref<!fir.box<!fir.ptr<i32>>>, !fir.ref<!fir.box<!fir.ptr<i32>>>)
534534
!CHECK: %[[C10:.*]] = arith.constant 10 : i32
535535
!CHECK: %[[A_BOX:.*]] = fir.load %[[VAL_1_DECL]]#0 : !fir.ref<!fir.box<!fir.ptr<i32>>>
536536
!CHECK: %[[A_ADDR:.*]] = fir.box_addr %[[A_BOX]] : (!fir.box<!fir.ptr<i32>>) -> !fir.ptr<i32>

flang/test/Lower/OpenMP/use-device-ptr-to-use-device-addr.f90

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
! use_device_ptr to use_device_addr works, without breaking any functionality.
77

88
!CHECK: func.func @{{.*}}only_use_device_ptr()
9-
!CHECK: omp.target_data use_device_addr(%{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}} : !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>>) use_device_ptr(%{{.*}} -> %{{.*}} : !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>) {
9+
10+
!CHECK: omp.target_data use_device_addr(%{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}} : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) use_device_ptr(%{{.*}} -> %{{.*}} : !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>) {
1011
subroutine only_use_device_ptr
1112
use iso_c_binding
1213
integer, pointer, dimension(:) :: array
@@ -18,7 +19,7 @@ subroutine only_use_device_ptr
1819
end subroutine
1920

2021
!CHECK: func.func @{{.*}}mix_use_device_ptr_and_addr()
21-
!CHECK: omp.target_data use_device_addr(%{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}} : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>) use_device_ptr({{.*}} : !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>) {
22+
!CHECK: omp.target_data use_device_addr(%{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}} : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>) use_device_ptr({{.*}} : !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>) {
2223
subroutine mix_use_device_ptr_and_addr
2324
use iso_c_binding
2425
integer, pointer, dimension(:) :: array
@@ -30,7 +31,7 @@ subroutine mix_use_device_ptr_and_addr
3031
end subroutine
3132

3233
!CHECK: func.func @{{.*}}only_use_device_addr()
33-
!CHECK: omp.target_data use_device_addr(%{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}} : !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>, !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>>) {
34+
!CHECK: omp.target_data use_device_addr(%{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}} : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>, !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) {
3435
subroutine only_use_device_addr
3536
use iso_c_binding
3637
integer, pointer, dimension(:) :: array
@@ -42,7 +43,7 @@ subroutine only_use_device_addr
4243
end subroutine
4344

4445
!CHECK: func.func @{{.*}}mix_use_device_ptr_and_addr_and_map()
45-
!CHECK: omp.target_data map_entries(%{{.*}}, %{{.*}} : !fir.ref<i32>, !fir.ref<i32>) use_device_addr(%{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}} : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>) use_device_ptr(%{{.*}} : !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>) {
46+
!CHECK: omp.target_data map_entries(%{{.*}}, %{{.*}} : !fir.ref<i32>, !fir.ref<i32>) use_device_addr(%{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}}, %{{.*}} -> %{{.*}} : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>) use_device_ptr(%{{.*}} : !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>) {
4647
subroutine mix_use_device_ptr_and_addr_and_map
4748
use iso_c_binding
4849
integer :: i, j
@@ -55,7 +56,7 @@ subroutine mix_use_device_ptr_and_addr_and_map
5556
end subroutine
5657

5758
!CHECK: func.func @{{.*}}only_use_map()
58-
!CHECK: omp.target_data map_entries(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>, !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>>) {
59+
!CHECK: omp.target_data map_entries(%{{.*}}, %{{.*}}, %{{.*}}, %{{.*}}, %{{.*}} : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>, !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xf32>>>, !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) {
5960
subroutine only_use_map
6061
use iso_c_binding
6162
integer, pointer, dimension(:) :: array

flang/test/Transforms/omp-map-info-finalization.fir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ module attributes {omp.is_target_device = false} {
3939
// CHECK: %[[BASE_ADDR_OFF_2:.*]] = fir.box_offset %[[ALLOCA]] base_addr : (!fir.ref<!fir.box<!fir.array<?xi32>>>) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>
4040
// CHECK: %[[DESC_MEMBER_MAP_2:.*]] = omp.map.info var_ptr(%[[ALLOCA]] : !fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.array<?xi32>) var_ptr_ptr(%[[BASE_ADDR_OFF_2]] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) map_clauses(from) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>> {name = ""}
4141
// CHECK: %[[DESC_PARENT_MAP_2:.*]] = omp.map.info var_ptr(%[[ALLOCA]] : !fir.ref<!fir.box<!fir.array<?xi32>>>, !fir.box<!fir.array<?xi32>>) map_clauses(from) capture(ByRef) members(%[[DESC_MEMBER_MAP_2]] : [0] : !fir.llvm_ptr<!fir.ref<!fir.array<?xi32>>>) -> !fir.ref<!fir.array<?xi32>>
42-
// CHECK: omp.target map_entries(%[[DESC_MEMBER_MAP]] -> %[[ARG1:.*]], %[[DESC_PARENT_MAP]] -> %[[ARG2:.*]], %[[DESC_MEMBER_MAP_2]] -> %[[ARG3:.*]], %[[DESC_PARENT_MAP_2]] -> %[[ARG4:.*]] : {{.*}}) {
42+
// CHECK: omp.target map_entries(%[[DESC_PARENT_MAP]] -> %[[ARG1:.*]], %[[DESC_PARENT_MAP_2]] -> %[[ARG2:.*]], %[[DESC_MEMBER_MAP]] -> %[[ARG3:.*]], %[[DESC_MEMBER_MAP_2]] -> %[[ARG4:.*]] : {{.*}}) {
4343

4444
// -----
4545

0 commit comments

Comments
 (0)