Skip to content

Commit 03d9a31

Browse files
authored
[Flang][OpenMP] Update flang with changes to the OpenMP dialect (#92524)
This patch applies fixes after the updates to OpenMP clause operands, as well as updating some tests that were impacted by changes to the ordering or assembly format of some clauses in MLIR.
1 parent d1fcfce commit 03d9a31

10 files changed

+43
-42
lines changed

flang/lib/Lower/OpenMP/ClauseProcessor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ bool ClauseProcessor::processEnter(
10731073
}
10741074

10751075
bool ClauseProcessor::processUseDeviceAddr(
1076-
mlir::omp::UseDeviceClauseOps &result,
1076+
mlir::omp::UseDeviceAddrClauseOps &result,
10771077
llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
10781078
llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
10791079
llvm::SmallVectorImpl<const semantics::Symbol *> &useDeviceSyms) const {
@@ -1085,7 +1085,7 @@ bool ClauseProcessor::processUseDeviceAddr(
10851085
}
10861086

10871087
bool ClauseProcessor::processUseDevicePtr(
1088-
mlir::omp::UseDeviceClauseOps &result,
1088+
mlir::omp::UseDevicePtrClauseOps &result,
10891089
llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
10901090
llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
10911091
llvm::SmallVectorImpl<const semantics::Symbol *> &useDeviceSyms) const {

flang/lib/Lower/OpenMP/ClauseProcessor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,12 @@ class ClauseProcessor {
129129
mlir::omp::ReductionClauseOps &result) const;
130130
bool processTo(llvm::SmallVectorImpl<DeclareTargetCapturePair> &result) const;
131131
bool processUseDeviceAddr(
132-
mlir::omp::UseDeviceClauseOps &result,
132+
mlir::omp::UseDeviceAddrClauseOps &result,
133133
llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
134134
llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
135135
llvm::SmallVectorImpl<const semantics::Symbol *> &useDeviceSyms) const;
136136
bool processUseDevicePtr(
137-
mlir::omp::UseDeviceClauseOps &result,
137+
mlir::omp::UseDevicePtrClauseOps &result,
138138
llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
139139
llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
140140
llvm::SmallVectorImpl<const semantics::Symbol *> &useDeviceSyms) const;

flang/lib/Lower/OpenMP/OpenMP.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@ createAndSetPrivatizedLoopVar(lower::AbstractConverter &converter,
244244
// clause. Support for such list items in a use_device_ptr clause
245245
// is deprecated."
246246
static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
247-
mlir::omp::UseDeviceClauseOps &clauseOps,
247+
llvm::SmallVectorImpl<mlir::Value> &useDeviceAddrVars,
248+
llvm::SmallVectorImpl<mlir::Value> &useDevicePtrVars,
248249
llvm::SmallVectorImpl<mlir::Type> &useDeviceTypes,
249250
llvm::SmallVectorImpl<mlir::Location> &useDeviceLocs,
250251
llvm::SmallVectorImpl<const semantics::Symbol *> &useDeviceSymbols) {
@@ -256,22 +257,21 @@ static void promoteNonCPtrUseDevicePtrArgsToUseDeviceAddr(
256257

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

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

12031204
static void genTargetEnterExitUpdateDataClauses(

flang/test/Lower/OpenMP/atomic-capture.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ program OmpAtomicCapture
3535
!CHECK: %[[SUB:.*]] = arith.subi %[[VAL_8]], %[[VAL_X_LOADED]] : i32
3636
!CHECK: %[[NO_REASSOC:.*]] = hlfir.no_reassoc %[[SUB]] : i32
3737
!CHECK: %[[ADD:.*]] = arith.addi %[[VAL_20]], %[[NO_REASSOC]] : i32
38-
!CHECK: omp.atomic.capture memory_order(acquire) hint(nonspeculative) {
38+
!CHECK: omp.atomic.capture hint(nonspeculative) memory_order(acquire) {
3939
!CHECK: omp.atomic.read %[[VAL_X_DECLARE]]#1 = %[[VAL_Y_DECLARE]]#1 : !fir.ref<i32>, i32
4040
!CHECK: omp.atomic.write %[[VAL_Y_DECLARE]]#1 = %[[ADD]] : !fir.ref<i32>, i32
4141
!CHECK: }

flang/test/Lower/OpenMP/copyin-order.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

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

5-
!CHECK: omp.parallel if(%{{[0-9]+}} : i1) {
5+
!CHECK: omp.parallel if(%{{[0-9]+}}) {
66
!CHECK: %[[THP1:[0-9]+]] = omp.threadprivate %{{[0-9]+}}#1
77
!CHECK: %[[DCL1:[0-9]+]]:2 = hlfir.declare %[[THP1]] {uniq_name = "_QFcopyin_scalar_arrayEx1"}
88
!CHECK: %[[LD1:[0-9]+]] = fir.load %{{[0-9]+}}#0

flang/test/Lower/OpenMP/parallel-wsloop.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ subroutine parallel_do_with_parallel_clauses(cond, nt)
3535
! CHECK: %[[COND:.*]] = fir.load %[[COND_DECL]]#0 : !fir.ref<!fir.logical<4>>
3636
! CHECK: %[[COND_CVT:.*]] = fir.convert %[[COND]] : (!fir.logical<4>) -> i1
3737
! CHECK: %[[NT:.*]] = fir.load %[[NT_DECL]]#0 : !fir.ref<i32>
38-
! CHECK: omp.parallel if(%[[COND_CVT]] : i1) num_threads(%[[NT]] : i32) proc_bind(close)
38+
! CHECK: omp.parallel if(%[[COND_CVT]]) num_threads(%[[NT]] : i32) proc_bind(close)
3939
! CHECK: %[[WS_LB:.*]] = arith.constant 1 : i32
4040
! CHECK: %[[WS_UB:.*]] = arith.constant 9 : i32
4141
! CHECK: %[[WS_STEP:.*]] = arith.constant 1 : i32

flang/test/Lower/OpenMP/parallel.f90

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,63 +24,63 @@ subroutine parallel_if(alpha, beta, gamma)
2424
logical(4) :: logical4
2525
logical(8) :: logical8
2626

27-
!CHECK: omp.parallel if(%{{.*}} : i1) {
27+
!CHECK: omp.parallel if(%{{.*}}) {
2828
!$omp parallel if(alpha .le. 0)
2929
!CHECK: fir.call
3030
call f1()
3131
!CHECK: omp.terminator
3232
!$omp end parallel
3333

34-
!CHECK: omp.parallel if(%{{.*}} : i1) {
34+
!CHECK: omp.parallel if(%{{.*}}) {
3535
!$omp parallel if(.false.)
3636
!CHECK: fir.call
3737
call f2()
3838
!CHECK: omp.terminator
3939
!$omp end parallel
4040

41-
!CHECK: omp.parallel if(%{{.*}} : i1) {
41+
!CHECK: omp.parallel if(%{{.*}}) {
4242
!$omp parallel if(alpha .ge. 0)
4343
!CHECK: fir.call
4444
call f3()
4545
!CHECK: omp.terminator
4646
!$omp end parallel
4747

48-
!CHECK: omp.parallel if(%{{.*}} : i1) {
48+
!CHECK: omp.parallel if(%{{.*}}) {
4949
!$omp parallel if(.true.)
5050
!CHECK: fir.call
5151
call f4()
5252
!CHECK: omp.terminator
5353
!$omp end parallel
5454

55-
!CHECK: omp.parallel if(%{{.*}} : i1) {
55+
!CHECK: omp.parallel if(%{{.*}}) {
5656
!$omp parallel if(beta)
5757
!CHECK: fir.call
5858
call f1()
5959
!CHECK: omp.terminator
6060
!$omp end parallel
6161

62-
!CHECK: omp.parallel if(%{{.*}} : i1) {
62+
!CHECK: omp.parallel if(%{{.*}}) {
6363
!$omp parallel if(logical1)
6464
!CHECK: fir.call
6565
call f1()
6666
!CHECK: omp.terminator
6767
!$omp end parallel
6868

69-
!CHECK: omp.parallel if(%{{.*}} : i1) {
69+
!CHECK: omp.parallel if(%{{.*}}) {
7070
!$omp parallel if(logical2)
7171
!CHECK: fir.call
7272
call f1()
7373
!CHECK: omp.terminator
7474
!$omp end parallel
7575

76-
!CHECK: omp.parallel if(%{{.*}} : i1) {
76+
!CHECK: omp.parallel if(%{{.*}}) {
7777
!$omp parallel if(logical4)
7878
!CHECK: fir.call
7979
call f1()
8080
!CHECK: omp.terminator
8181
!$omp end parallel
8282

83-
!CHECK: omp.parallel if(%{{.*}} : i1) {
83+
!CHECK: omp.parallel if(%{{.*}}) {
8484
!$omp parallel if(logical8)
8585
!CHECK: fir.call
8686
call f1()
@@ -173,7 +173,7 @@ subroutine parallel_multiple_clauses(alpha, num_threads)
173173
integer, intent(inout) :: alpha
174174
integer, intent(in) :: num_threads
175175

176-
!CHECK: omp.parallel if({{.*}} : i1) proc_bind(master) {
176+
!CHECK: omp.parallel if({{.*}}) proc_bind(master) {
177177
!$omp parallel if(alpha .le. 0) proc_bind(master)
178178
!CHECK: fir.call
179179
call f1()
@@ -187,14 +187,14 @@ subroutine parallel_multiple_clauses(alpha, num_threads)
187187
!CHECK: omp.terminator
188188
!$omp end parallel
189189

190-
!CHECK: omp.parallel if({{.*}} : i1) num_threads({{.*}} : i32) {
190+
!CHECK: omp.parallel if({{.*}}) num_threads({{.*}} : i32) {
191191
!$omp parallel num_threads(num_threads) if(alpha .le. 0)
192192
!CHECK: fir.call
193193
call f3()
194194
!CHECK: omp.terminator
195195
!$omp end parallel
196196

197-
!CHECK: omp.parallel if({{.*}} : i1) num_threads({{.*}} : i32) allocate(
197+
!CHECK: omp.parallel if({{.*}}) num_threads({{.*}} : i32) allocate(
198198
!CHECK: %{{.+}} : i64 -> %{{.+}} : !fir.ref<i32>
199199
!CHECK: ) {
200200
!$omp parallel num_threads(num_threads) if(alpha .le. 0) allocate(omp_high_bw_mem_alloc: alpha) private(alpha)

flang/test/Lower/OpenMP/simd.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ subroutine simd_with_simdlen_safelen_clause(n, threshold)
148148
! CHECK: %[[LB:.*]] = arith.constant 1 : i32
149149
! CHECK: %[[UB:.*]] = fir.load %[[ARG_N]]#0
150150
! CHECK: %[[STEP:.*]] = arith.constant 1 : i32
151-
! CHECK: omp.simd simdlen(1) safelen(2) {
151+
! CHECK: omp.simd safelen(2) simdlen(1) {
152152
! CHECK-NEXT: omp.loop_nest (%[[I:.*]]) : i32 = (%[[LB]]) to (%[[UB]]) inclusive step (%[[STEP]]) {
153153
do i = 1, n
154154
! CHECK: fir.store %[[I]] to %[[LOCAL:.*]]#1 : !fir.ref<i32>

flang/test/Lower/OpenMP/target.f90

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ subroutine omp_target_enter_depend
3030
!$omp end task
3131
!CHECK: %[[BOUNDS:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}})
3232
!CHECK: %[[MAP:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(to) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref<!fir.array<1024xi32>> {name = "a"}
33-
!CHECK: omp.target_enter_data map_entries(%[[MAP]] : !fir.ref<!fir.array<1024xi32>>) depend(taskdependin -> %[[A]]#1 : !fir.ref<!fir.array<1024xi32>>)
33+
!CHECK: omp.target_enter_data depend(taskdependin -> %[[A]]#1 : !fir.ref<!fir.array<1024xi32>>) map_entries(%[[MAP]] : !fir.ref<!fir.array<1024xi32>>)
3434
!$omp target enter data map(to: a) depend(in: a)
3535
return
3636
end subroutine omp_target_enter_depend
@@ -84,7 +84,7 @@ subroutine omp_target_enter_if
8484
!CHECK: %[[VAL_5:.*]] = arith.cmpi slt, %[[VAL_3]], %[[VAL_4]] : i32
8585
!CHECK: %[[BOUNDS:.*]] = omp.map.bounds lower_bound({{.*}}) upper_bound({{.*}}) extent({{.*}}) stride({{.*}}) start_idx({{.*}})
8686
!CHECK: %[[MAP:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(to) capture(ByRef) bounds(%[[BOUNDS]]) -> !fir.ref<!fir.array<1024xi32>> {name = "a"}
87-
!CHECK: omp.target_enter_data if(%[[VAL_5]] : i1) map_entries(%[[MAP]] : !fir.ref<!fir.array<1024xi32>>)
87+
!CHECK: omp.target_enter_data if(%[[VAL_5]]) map_entries(%[[MAP]] : !fir.ref<!fir.array<1024xi32>>)
8888
!$omp target enter data if(i<10) map(to: a)
8989
end subroutine omp_target_enter_if
9090

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

@@ -190,7 +190,7 @@ subroutine omp_target_update_depend
190190

191191
!CHECK: %[[BOUNDS:.*]] = omp.map.bounds
192192
!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"}
193-
!CHECK: omp.target_update motion_entries(%[[MAP]] : !fir.ref<!fir.array<1024xi32>>) depend(taskdependin -> %[[A]]#1 : !fir.ref<!fir.array<1024xi32>>)
193+
!CHECK: omp.target_update depend(taskdependin -> %[[A]]#1 : !fir.ref<!fir.array<1024xi32>>) map_entries(%[[MAP]] : !fir.ref<!fir.array<1024xi32>>)
194194
!$omp target update to(a) depend(in:a)
195195
end subroutine omp_target_update_depend
196196

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

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

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

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

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

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

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

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

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

281-
!CHECK: omp.target_update nowait motion_entries
281+
!CHECK: omp.target_update nowait map_entries
282282
!$omp target update from(a) nowait
283283
end subroutine omp_target_update_nowait
284284

@@ -373,7 +373,7 @@ subroutine omp_target_depend
373373
!CHECK: %[[UBOUND_A:.*]] = arith.subi %c1024, %c1 : index
374374
!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)
375375
!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"}
376-
!CHECK: omp.target map_entries(%[[MAP_A]] -> %[[BB0_ARG:.*]] : !fir.ref<!fir.array<1024xi32>>) depend(taskdependin -> %[[A]]#1 : !fir.ref<!fir.array<1024xi32>>) {
376+
!CHECK: omp.target depend(taskdependin -> %[[A]]#1 : !fir.ref<!fir.array<1024xi32>>) map_entries(%[[MAP_A]] -> %[[BB0_ARG:.*]] : !fir.ref<!fir.array<1024xi32>>) {
377377
!$omp target map(tofrom: a) depend(in: a)
378378
a(1) = 10
379379
!CHECK: omp.terminator
@@ -512,7 +512,7 @@ subroutine omp_target_device_ptr
512512
type(c_ptr) :: a
513513
integer, target :: b
514514
!CHECK: %[[MAP:.*]] = omp.map.info var_ptr({{.*}}) map_clauses(tofrom) capture(ByRef) -> {{.*}} {name = "a"}
515-
!CHECK: omp.target_data map_entries(%[[MAP]]{{.*}}
515+
!CHECK: omp.target_data use_device_ptr({{.*}}) map_entries(%[[MAP]]{{.*}}
516516
!$omp target data map(tofrom: a) use_device_ptr(a)
517517
!CHECK: ^bb0(%[[VAL_1:.*]]: !fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>):
518518
!CHECK: {{.*}} = fir.coordinate_of %[[VAL_1:.*]], {{.*}} : (!fir.ref<!fir.type<_QM__fortran_builtinsT__builtin_c_ptr{__address:i64}>>, !fir.field) -> !fir.ref<i64>
@@ -533,7 +533,7 @@ subroutine omp_target_device_addr
533533
!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>>>)
534534
!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 = ""}
535535
!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"}
536-
!CHECK: omp.target_data map_entries(%[[MAP_MEMBERS]], %[[MAP]] : {{.*}}) use_device_addr(%[[VAL_0_DECL]]#1 : !fir.ref<!fir.box<!fir.ptr<i32>>>) {
536+
!CHECK: omp.target_data use_device_addr(%[[VAL_0_DECL]]#1 : !fir.ref<!fir.box<!fir.ptr<i32>>>) map_entries(%[[MAP_MEMBERS]], %[[MAP]] : {{.*}}) {
537537
!$omp target data map(tofrom: a) use_device_addr(a)
538538
!CHECK: ^bb0(%[[VAL_1:.*]]: !fir.ref<!fir.box<!fir.ptr<i32>>>):
539539
!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>>>)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ subroutine only_use_device_addr
4747
end subroutine
4848

4949
!CHECK: func.func @{{.*}}mix_use_device_ptr_and_addr_and_map()
50-
!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>>>>) {
50+
!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>) {
5151
!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>>>>):
5252
subroutine mix_use_device_ptr_and_addr_and_map
5353
use iso_c_binding

0 commit comments

Comments
 (0)