Skip to content

[Flang][OpenMP] Update flang with changes to the OpenMP dialect #92524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions flang/lib/Lower/OpenMP/ClauseProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ bool ClauseProcessor::processEnter(
}

bool ClauseProcessor::processUseDeviceAddr(
mlir::omp::UseDeviceClauseOps &result,
mlir::omp::UseDeviceAddrClauseOps &result,
llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
llvm::SmallVectorImpl<const semantics::Symbol *> &useDeviceSyms) const {
Expand All @@ -1085,7 +1085,7 @@ bool ClauseProcessor::processUseDeviceAddr(
}

bool ClauseProcessor::processUseDevicePtr(
mlir::omp::UseDeviceClauseOps &result,
mlir::omp::UseDevicePtrClauseOps &result,
llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
llvm::SmallVectorImpl<const semantics::Symbol *> &useDeviceSyms) const {
Expand Down
4 changes: 2 additions & 2 deletions flang/lib/Lower/OpenMP/ClauseProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ class ClauseProcessor {
mlir::omp::ReductionClauseOps &result) const;
bool processTo(llvm::SmallVectorImpl<DeclareTargetCapturePair> &result) const;
bool processUseDeviceAddr(
mlir::omp::UseDeviceClauseOps &result,
mlir::omp::UseDeviceAddrClauseOps &result,
llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
llvm::SmallVectorImpl<const semantics::Symbol *> &useDeviceSyms) const;
bool processUseDevicePtr(
mlir::omp::UseDeviceClauseOps &result,
mlir::omp::UseDevicePtrClauseOps &result,
llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
llvm::SmallVectorImpl<const semantics::Symbol *> &useDeviceSyms) const;
Expand Down
19 changes: 10 additions & 9 deletions flang/lib/Lower/OpenMP/OpenMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ createAndSetPrivatizedLoopVar(lower::AbstractConverter &converter,
// clause. Support for such list items in a use_device_ptr clause
// is deprecated."
static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
mlir::omp::UseDeviceClauseOps &clauseOps,
llvm::SmallVectorImpl<mlir::Value> &useDeviceAddrVars,
llvm::SmallVectorImpl<mlir::Value> &useDevicePtrVars,
llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
llvm::SmallVectorImpl<const semantics::Symbol *> &useDeviceSymbols) {
Expand All @@ -256,22 +257,21 @@ static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(

// Iterate over our use_device_ptr list and shift all non-cptr arguments into
// use_device_addr.
for (auto *it = clauseOps.useDevicePtrVars.begin();
it != clauseOps.useDevicePtrVars.end();) {
for (auto *it = useDevicePtrVars.begin(); it != useDevicePtrVars.end();) {
if (!fir::isa_builtin_cptr_type(fir::unwrapRefType(it->getType()))) {
clauseOps.useDeviceAddrVars.push_back(*it);
useDeviceAddrVars.push_back(*it);
// We have to shuffle the symbols around as well, to maintain
// the correct Input -> BlockArg for use_device_ptr/use_device_addr.
// NOTE: However, as map's do not seem to be included currently
// this isn't as pertinent, but we must try to maintain for
// future alterations. I believe the reason they are not currently
// is that the BlockArg assign/lowering needs to be extended
// to a greater set of types.
auto idx = std::distance(clauseOps.useDevicePtrVars.begin(), it);
auto idx = std::distance(useDevicePtrVars.begin(), it);
moveElementToBack(idx, useDeviceTypes);
moveElementToBack(idx, useDeviceLocs);
moveElementToBack(idx, useDeviceSymbols);
it = clauseOps.useDevicePtrVars.erase(it);
it = useDevicePtrVars.erase(it);
continue;
}
++it;
Expand Down Expand Up @@ -1024,7 +1024,7 @@ static void genCriticalDeclareClauses(lower::AbstractConverter &converter,
llvm::StringRef name) {
ClauseProcessor cp(converter, semaCtx, clauses);
cp.processHint(clauseOps);
clauseOps.nameAttr =
clauseOps.criticalNameAttr =
mlir::StringAttr::get(converter.getFirOpBuilder().getContext(), name);
}

Expand Down Expand Up @@ -1196,8 +1196,9 @@ static void genTargetDataClauses(
// ordering.
// TODO: Perhaps create a user provideable compiler option that will
// re-introduce a hard-error rather than a warning in these cases.
promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(clauseOps, useDeviceTypes,
useDeviceLocs, useDeviceSyms);
promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
clauseOps.useDeviceAddrVars, clauseOps.useDevicePtrVars, useDeviceTypes,
useDeviceLocs, useDeviceSyms);
}

static void genTargetEnterExitUpdateDataClauses(
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/atomic-capture.f90
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ program OmpAtomicCapture
!CHECK: %[[SUB:.*]] = arith.subi %[[VAL_8]], %[[VAL_X_LOADED]] : i32
!CHECK: %[[NO_REASSOC:.*]] = hlfir.no_reassoc %[[SUB]] : i32
!CHECK: %[[ADD:.*]] = arith.addi %[[VAL_20]], %[[NO_REASSOC]] : i32
!CHECK: omp.atomic.capture memory_order(acquire) hint(nonspeculative) {
!CHECK: omp.atomic.capture hint(nonspeculative) memory_order(acquire) {
!CHECK: omp.atomic.read %[[VAL_X_DECLARE]]#1 = %[[VAL_Y_DECLARE]]#1 : !fir.ref<i32>, i32
!CHECK: omp.atomic.write %[[VAL_Y_DECLARE]]#1 = %[[ADD]] : !fir.ref<i32>, i32
!CHECK: }
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/copyin-order.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

!https://github.com/llvm/llvm-project/issues/91205

!CHECK: omp.parallel if(%{{[0-9]+}} : i1) {
!CHECK: omp.parallel if(%{{[0-9]+}}) {
!CHECK: %[[THP1:[0-9]+]] = omp.threadprivate %{{[0-9]+}}#1
!CHECK: %[[DCL1:[0-9]+]]:2 = hlfir.declare %[[THP1]] {uniq_name = "_QFcopyin_scalar_arrayEx1"}
!CHECK: %[[LD1:[0-9]+]] = fir.load %{{[0-9]+}}#0
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/parallel-wsloop.f90
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ subroutine parallel_do_with_parallel_clauses(cond, nt)
! CHECK: %[[COND:.*]] = fir.load %[[COND_DECL]]#0 : !fir.ref<!fir.logical<4>>
! CHECK: %[[COND_CVT:.*]] = fir.convert %[[COND]] : (!fir.logical<4>) -> i1
! CHECK: %[[NT:.*]] = fir.load %[[NT_DECL]]#0 : !fir.ref<i32>
! CHECK: omp.parallel if(%[[COND_CVT]] : i1) num_threads(%[[NT]] : i32) proc_bind(close)
! CHECK: omp.parallel if(%[[COND_CVT]]) num_threads(%[[NT]] : i32) proc_bind(close)
! CHECK: %[[WS_LB:.*]] = arith.constant 1 : i32
! CHECK: %[[WS_UB:.*]] = arith.constant 9 : i32
! CHECK: %[[WS_STEP:.*]] = arith.constant 1 : i32
Expand Down
24 changes: 12 additions & 12 deletions flang/test/Lower/OpenMP/parallel.f90
Original file line number Diff line number Diff line change
Expand Up @@ -24,63 +24,63 @@ subroutine parallel_if(alpha, beta, gamma)
logical(4) :: logical4
logical(8) :: logical8

!CHECK: omp.parallel if(%{{.*}} : i1) {
!CHECK: omp.parallel if(%{{.*}}) {
!$omp parallel if(alpha .le. 0)
!CHECK: fir.call
call f1()
!CHECK: omp.terminator
!$omp end parallel

!CHECK: omp.parallel if(%{{.*}} : i1) {
!CHECK: omp.parallel if(%{{.*}}) {
!$omp parallel if(.false.)
!CHECK: fir.call
call f2()
!CHECK: omp.terminator
!$omp end parallel

!CHECK: omp.parallel if(%{{.*}} : i1) {
!CHECK: omp.parallel if(%{{.*}}) {
!$omp parallel if(alpha .ge. 0)
!CHECK: fir.call
call f3()
!CHECK: omp.terminator
!$omp end parallel

!CHECK: omp.parallel if(%{{.*}} : i1) {
!CHECK: omp.parallel if(%{{.*}}) {
!$omp parallel if(.true.)
!CHECK: fir.call
call f4()
!CHECK: omp.terminator
!$omp end parallel

!CHECK: omp.parallel if(%{{.*}} : i1) {
!CHECK: omp.parallel if(%{{.*}}) {
!$omp parallel if(beta)
!CHECK: fir.call
call f1()
!CHECK: omp.terminator
!$omp end parallel

!CHECK: omp.parallel if(%{{.*}} : i1) {
!CHECK: omp.parallel if(%{{.*}}) {
!$omp parallel if(logical1)
!CHECK: fir.call
call f1()
!CHECK: omp.terminator
!$omp end parallel

!CHECK: omp.parallel if(%{{.*}} : i1) {
!CHECK: omp.parallel if(%{{.*}}) {
!$omp parallel if(logical2)
!CHECK: fir.call
call f1()
!CHECK: omp.terminator
!$omp end parallel

!CHECK: omp.parallel if(%{{.*}} : i1) {
!CHECK: omp.parallel if(%{{.*}}) {
!$omp parallel if(logical4)
!CHECK: fir.call
call f1()
!CHECK: omp.terminator
!$omp end parallel

!CHECK: omp.parallel if(%{{.*}} : i1) {
!CHECK: omp.parallel if(%{{.*}}) {
!$omp parallel if(logical8)
!CHECK: fir.call
call f1()
Expand Down Expand Up @@ -173,7 +173,7 @@ subroutine parallel_multiple_clauses(alpha, num_threads)
integer, intent(inout) :: alpha
integer, intent(in) :: num_threads

!CHECK: omp.parallel if({{.*}} : i1) proc_bind(master) {
!CHECK: omp.parallel if({{.*}}) proc_bind(master) {
!$omp parallel if(alpha .le. 0) proc_bind(master)
!CHECK: fir.call
call f1()
Expand All @@ -187,14 +187,14 @@ subroutine parallel_multiple_clauses(alpha, num_threads)
!CHECK: omp.terminator
!$omp end parallel

!CHECK: omp.parallel if({{.*}} : i1) num_threads({{.*}} : i32) {
!CHECK: omp.parallel if({{.*}}) num_threads({{.*}} : i32) {
!$omp parallel num_threads(num_threads) if(alpha .le. 0)
!CHECK: fir.call
call f3()
!CHECK: omp.terminator
!$omp end parallel

!CHECK: omp.parallel if({{.*}} : i1) num_threads({{.*}} : i32) allocate(
!CHECK: omp.parallel if({{.*}}) num_threads({{.*}} : i32) allocate(
!CHECK: %{{.+}} : i64 -> %{{.+}} : !fir.ref<i32>
!CHECK: ) {
!$omp parallel num_threads(num_threads) if(alpha .le. 0) allocate(omp_high_bw_mem_alloc: alpha) private(alpha)
Expand Down
2 changes: 1 addition & 1 deletion flang/test/Lower/OpenMP/simd.f90
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ subroutine simd_with_simdlen_safelen_clause(n, threshold)
! CHECK: %[[LB:.*]] = arith.constant 1 : i32
! CHECK: %[[UB:.*]] = fir.load %[[ARG_N]]#0
! CHECK: %[[STEP:.*]] = arith.constant 1 : i32
! CHECK: omp.simd simdlen(1) safelen(2) {
! CHECK: omp.simd safelen(2) simdlen(1) {
! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[LB]]) to (%[[UB]]) inclusive step (%[[STEP]]) {
do i = 1, n
! CHECK: fir.store %[[I]] to %[[LOCAL:.*]]#1 : !fir.ref<i32>
Expand Down
24 changes: 12 additions & 12 deletions flang/test/Lower/OpenMP/target.f90
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ subroutine omp_target_enter_depend
!$omp end task
!CHECK: %[[BOUNDS:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}})
!CHECK: %[[MAP:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(to) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref<!fir.array<1024xi32>> {name = "a"}
!CHECK: omp.target_enter_data map_entries(%[[MAP]] : !fir.ref<!fir.array<1024xi32>>) depend(taskdependin -> %[[A]]#1 : !fir.ref<!fir.array<1024xi32>>)
!CHECK: omp.target_enter_data depend(taskdependin -> %[[A]]#1 : !fir.ref<!fir.array<1024xi32>>) map_entries(%[[MAP]] : !fir.ref<!fir.array<1024xi32>>)
!$omp target enter data map(to: a) depend(in: a)
return
end subroutine omp_target_enter_depend
Expand Down Expand Up @@ -84,7 +84,7 @@ subroutine omp_target_enter_if
!CHECK: %[[VAL_5:.*]] = arith.cmpi slt, %[[VAL_3]], %[[VAL_4]] : i32
!CHECK: %[[BOUNDS:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}})
!CHECK: %[[MAP:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(to) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref<!fir.array<1024xi32>> {name = "a"}
!CHECK: omp.target_enter_data if(%[[VAL_5]] : i1) map_entries(%[[MAP]] : !fir.ref<!fir.array<1024xi32>>)
!CHECK: omp.target_enter_data if(%[[VAL_5]]) map_entries(%[[MAP]] : !fir.ref<!fir.array<1024xi32>>)
!$omp target enter data if(i<10) map(to: a)
end subroutine omp_target_enter_if

Expand Down Expand Up @@ -169,7 +169,7 @@ subroutine omp_target_exit_depend
!$omp end task
!CHECK: %[[BOUNDS:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}})
!CHECK: %[[MAP:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(from) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref<!fir.array<1024xi32>> {name = "a"}
!CHECK: omp.target_exit_data map_entries(%[[MAP]] : !fir.ref<!fir.array<1024xi32>>) depend(taskdependout -> %[[A]]#1 : !fir.ref<!fir.array<1024xi32>>)
!CHECK: omp.target_exit_data depend(taskdependout -> %[[A]]#1 : !fir.ref<!fir.array<1024xi32>>) map_entries(%[[MAP]] : !fir.ref<!fir.array<1024xi32>>)
!$omp target exit data map(from: a) depend(out: a)
end subroutine omp_target_exit_depend

Expand All @@ -190,7 +190,7 @@ subroutine omp_target_update_depend

!CHECK: %[[BOUNDS:.*]] = omp.map.bounds
!CHECK: %[[MAP:.*]] = omp.map.info var_ptr(%[[A]]#0 : !fir.ref<!fir.array<1024xi32>>, !fir.array<1024xi32>) map_clauses(to) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref<!fir.array<1024xi32>> {name = "a"}
!CHECK: omp.target_update motion_entries(%[[MAP]] : !fir.ref<!fir.array<1024xi32>>) depend(taskdependin -> %[[A]]#1 : !fir.ref<!fir.array<1024xi32>>)
!CHECK: omp.target_update depend(taskdependin -> %[[A]]#1 : !fir.ref<!fir.array<1024xi32>>) map_entries(%[[MAP]] : !fir.ref<!fir.array<1024xi32>>)
!$omp target update to(a) depend(in:a)
end subroutine omp_target_update_depend

Expand All @@ -209,7 +209,7 @@ subroutine omp_target_update_to
!CHECK-SAME: map_clauses(to) capture(ByRef)
!CHECK-SAME: bounds(%[[BOUNDS]]) -> !fir.ref<!fir.array<1024xi32>> {name = "a"}

!CHECK: omp.target_update motion_entries(%[[TO_MAP]] : !fir.ref<!fir.array<1024xi32>>)
!CHECK: omp.target_update map_entries(%[[TO_MAP]] : !fir.ref<!fir.array<1024xi32>>)
!$omp target update to(a)
end subroutine omp_target_update_to

Expand All @@ -228,7 +228,7 @@ subroutine omp_target_update_from
!CHECK-SAME: map_clauses(from) capture(ByRef)
!CHECK-SAME: bounds(%[[BOUNDS]]) -> !fir.ref<!fir.array<1024xi32>> {name = "a"}

!CHECK: omp.target_update motion_entries(%[[FROM_MAP]] : !fir.ref<!fir.array<1024xi32>>)
!CHECK: omp.target_update map_entries(%[[FROM_MAP]] : !fir.ref<!fir.array<1024xi32>>)
!$omp target update from(a)
end subroutine omp_target_update_from

Expand All @@ -245,7 +245,7 @@ subroutine omp_target_update_if
!CHECK-DAG: %[[BOUNDS:.*]] = omp.map.bounds
!CHECK-DAG: %[[COND:.*]] = fir.convert %{{.*}} : (!fir.logical<4>) -> i1

!CHECK: omp.target_update if(%[[COND]] : i1) motion_entries
!CHECK: omp.target_update if(%[[COND]]) map_entries
!$omp target update from(a) if(i)
end subroutine omp_target_update_if

Expand All @@ -262,7 +262,7 @@ subroutine omp_target_update_device
!CHECK-DAG: %[[BOUNDS:.*]] = omp.map.bounds
!CHECK-DAG: %[[DEVICE:.*]] = arith.constant 1 : i32

!CHECK: omp.target_update device(%[[DEVICE]] : i32) motion_entries
!CHECK: omp.target_update device(%[[DEVICE]] : i32) map_entries
!$omp target update from(a) device(1)
end subroutine omp_target_update_device

Expand All @@ -278,7 +278,7 @@ subroutine omp_target_update_nowait
!CHECK-DAG: %[[A_DECL:.*]]:2 = hlfir.declare %{{.*}}(%{{.*}})
!CHECK-DAG: %[[BOUNDS:.*]] = omp.map.bounds

!CHECK: omp.target_update nowait motion_entries
!CHECK: omp.target_update nowait map_entries
!$omp target update from(a) nowait
end subroutine omp_target_update_nowait

Expand Down Expand Up @@ -373,7 +373,7 @@ subroutine omp_target_depend
!CHECK: %[[UBOUND_A:.*]] = arith.subi %c1024, %c1 : index
!CHECK: %[[BOUNDS_A:.*]] = omp.map.bounds lower_bound(%[[LBOUND_A]] : index) upper_bound(%[[UBOUND_A]] : index) extent(%[[EXTENT_A]] : index) stride(%[[STRIDE_A]] : index) start_idx(%[[STRIDE_A]] : index)
!CHECK: %[[MAP_A:.*]] = omp.map.info var_ptr(%[[A]]#0 : !fir.ref<!fir.array<1024xi32>>, !fir.array<1024xi32>) map_clauses(tofrom) capture(ByRef) bounds(%[[BOUNDS_A]]) -> !fir.ref<!fir.array<1024xi32>> {name = "a"}
!CHECK: omp.target map_entries(%[[MAP_A]] -> %[[BB0_ARG:.*]] : !fir.ref<!fir.array<1024xi32>>) depend(taskdependin -> %[[A]]#1 : !fir.ref<!fir.array<1024xi32>>) {
!CHECK: omp.target depend(taskdependin -> %[[A]]#1 : !fir.ref<!fir.array<1024xi32>>) map_entries(%[[MAP_A]] -> %[[BB0_ARG:.*]] : !fir.ref<!fir.array<1024xi32>>) {
!$omp target map(tofrom: a) depend(in: a)
a(1) = 10
!CHECK: omp.terminator
Expand Down Expand Up @@ -512,7 +512,7 @@ subroutine omp_target_device_ptr
type(c_ptr) :: a
integer, target :: b
!CHECK: %[[MAP:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(tofrom) capture(ByRef) -> {{.*}} {name = "a"}
!CHECK: omp.target_data map_entries(%[[MAP]]{{.*}}
!CHECK: omp.target_data use_device_ptr({{.*}}) map_entries(%[[MAP]]{{.*}}
!$omp target data map(tofrom: a) use_device_ptr(a)
!CHECK: ^bb0(%[[VAL_1:.*]]: !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>):
!CHECK: {{.*}} = fir.coordinate_of %[[VAL_1:.*]], {{.*}} : (!fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>, !fir.field) -> !fir.ref<i64>
Expand All @@ -533,7 +533,7 @@ subroutine omp_target_device_addr
!CHECK: %[[VAL_0_DECL:.*]]:2 = hlfir.declare %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>>>)
!CHECK: %[[MAP_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 = ""}
!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"}
!CHECK: omp.target_data map_entries(%[[MAP_MEMBERS]], %[[MAP]] : {{.*}}) use_device_addr(%[[VAL_0_DECL]]#1 : !fir.ref<!fir.box<!fir.ptr<i32>>>) {
!CHECK: omp.target_data use_device_addr(%[[VAL_0_DECL]]#1 : !fir.ref<!fir.box<!fir.ptr<i32>>>) map_entries(%[[MAP_MEMBERS]], %[[MAP]] : {{.*}}) {
!$omp target data map(tofrom: a) use_device_addr(a)
!CHECK: ^bb0(%[[VAL_1:.*]]: !fir.ref<!fir.box<!fir.ptr<i32>>>):
!CHECK: %[[VAL_1_DECL:.*]]:2 = hlfir.declare %[[VAL_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>>>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ subroutine only_use_device_addr
end subroutine

!CHECK: func.func @{{.*}}mix_use_device_ptr_and_addr_and_map()
!CHECK: omp.target_data map_entries(%{{.*}}, %{{.*}} : !fir.ref<i32>, !fir.ref<i32>) use_device_ptr(%{{.*}} : !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>) use_device_addr(%{{.*}}, %{{.*}} : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>) {
!CHECK: omp.target_data use_device_ptr(%{{.*}} : !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>) use_device_addr(%{{.*}}, %{{.*}} : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xi32>>>>, !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>) map_entries(%{{.*}}, %{{.*}} : !fir.ref<i32>, !fir.ref<i32>) {
!CHECK: ^bb0(%{{.*}}: !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>>>>):
subroutine mix_use_device_ptr_and_addr_and_map
use iso_c_binding
Expand Down
Loading
Loading