Skip to content

Commit 822c886

Browse files
committed
[flang][Lower] Add lowering for SYNC ALL, SYNC MEMORY and SYNC IMAGES to PRIF
1 parent 27f3283 commit 822c886

File tree

6 files changed

+328
-6
lines changed

6 files changed

+328
-6
lines changed

flang/include/flang/Optimizer/Builder/Runtime/Coarray.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ namespace fir::runtime {
3434
return fir::NameUniquer::doProcedure({"prif"}, {}, oss.str()); \
3535
}()
3636

37+
#define PRIF_STAT_TYPE builder.getRefType(builder.getI32Type())
38+
#define PRIF_ERRMSG_TYPE \
39+
fir::BoxType::get(fir::CharacterType::get(builder.getContext(), 1, \
40+
fir::CharacterType::unknownLen()))
41+
3742
/// Generate Call to runtime prif_init
3843
mlir::Value genInitCoarray(fir::FirOpBuilder &builder, mlir::Location loc);
3944

@@ -49,5 +54,15 @@ mlir::Value getNumImagesWithTeam(fir::FirOpBuilder &builder, mlir::Location loc,
4954
mlir::Value getThisImage(fir::FirOpBuilder &builder, mlir::Location loc,
5055
mlir::Value team = {});
5156

57+
/// Generate call to runtime subroutine prif_sync_all
58+
void genSyncAllStatement(fir::FirOpBuilder &builder, mlir::Location loc,
59+
mlir::Value stat, mlir::Value errmsg);
60+
/// Generate call to runtime subroutine prif_sync_memory
61+
void genSyncMemoryStatement(fir::FirOpBuilder &builder, mlir::Location loc,
62+
mlir::Value stat, mlir::Value errmsg);
63+
/// Generate call to runtime subroutine prif_sync_images
64+
void genSyncImagesStatement(fir::FirOpBuilder &builder, mlir::Location loc,
65+
mlir::Value imageSet, mlir::Value stat,
66+
mlir::Value errmsg);
5267
} // namespace fir::runtime
5368
#endif // FORTRAN_OPTIMIZER_BUILDER_RUNTIME_COARRAY_H

flang/lib/Lower/Runtime.cpp

Lines changed: 98 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "flang/Lower/OpenMP.h"
1313
#include "flang/Lower/StatementContext.h"
1414
#include "flang/Optimizer/Builder/FIRBuilder.h"
15+
#include "flang/Optimizer/Builder/Runtime/Coarray.h"
1516
#include "flang/Optimizer/Builder/Runtime/RTBuilder.h"
1617
#include "flang/Optimizer/Builder/Todo.h"
1718
#include "flang/Optimizer/Dialect/FIROpsSupport.h"
@@ -48,6 +49,50 @@ static void genUnreachable(fir::FirOpBuilder &builder, mlir::Location loc) {
4849
builder.setInsertionPointToStart(newBlock);
4950
}
5051

52+
// Check support of Multi-image features if -fcoarray is provided
53+
void checkCoarrayEnabled(Fortran::lower::AbstractConverter &converter,
54+
mlir::Location loc) {
55+
if (!converter.getFoldingContext().languageFeatures().IsEnabled(
56+
Fortran::common::LanguageFeature::Coarray))
57+
fir::emitFatalError(loc, "Coarrays disabled, use '-fcoarray' to enable.",
58+
false);
59+
}
60+
61+
/// Initializes values for STAT and ERRMSG
62+
static std::pair<mlir::Value, mlir::Value> getStatAndErrmsg(
63+
Fortran::lower::AbstractConverter &converter, mlir::Location loc,
64+
const std::list<Fortran::parser::StatOrErrmsg> &statOrErrList) {
65+
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
66+
Fortran::lower::StatementContext stmtCtx;
67+
68+
mlir::Value errMsgExpr, statExpr;
69+
for (const Fortran::parser::StatOrErrmsg &statOrErr : statOrErrList) {
70+
std::visit(Fortran::common::visitors{
71+
[&](const Fortran::parser::StatVariable &statVar) {
72+
statExpr = fir::getBase(converter.genExprAddr(
73+
loc, Fortran::semantics::GetExpr(statVar), stmtCtx));
74+
},
75+
[&](const Fortran::parser::MsgVariable &errMsgVar) {
76+
const Fortran::semantics::SomeExpr *expr =
77+
Fortran::semantics::GetExpr(errMsgVar);
78+
errMsgExpr = fir::getBase(
79+
converter.genExprBox(loc, *expr, stmtCtx));
80+
}},
81+
statOrErr.u);
82+
}
83+
84+
if (!statExpr) {
85+
statExpr = builder.create<fir::AbsentOp>(
86+
loc, builder.getRefType(builder.getI32Type()));
87+
}
88+
if (!errMsgExpr) {
89+
errMsgExpr = builder.create<fir::AbsentOp>(
90+
loc, fir::BoxType::get(fir::CharacterType::get(
91+
builder.getContext(), 1, fir::CharacterType::unknownLen())));
92+
}
93+
return {statExpr, errMsgExpr};
94+
}
95+
5196
//===----------------------------------------------------------------------===//
5297
// Misc. Fortran statements that lower to runtime calls
5398
//===----------------------------------------------------------------------===//
@@ -170,20 +215,67 @@ void Fortran::lower::genUnlockStatement(
170215

171216
void Fortran::lower::genSyncAllStatement(
172217
Fortran::lower::AbstractConverter &converter,
173-
const Fortran::parser::SyncAllStmt &) {
174-
TODO(converter.getCurrentLocation(), "coarray: SYNC ALL runtime");
218+
const Fortran::parser::SyncAllStmt &stmt) {
219+
mlir::Location loc = converter.getCurrentLocation();
220+
checkCoarrayEnabled(converter, loc);
221+
222+
// Handle STAT and ERRMSG values
223+
const std::list<Fortran::parser::StatOrErrmsg> &statOrErrList = stmt.v;
224+
auto [statAddr, errMsgAddr] = getStatAndErrmsg(converter, loc, statOrErrList);
225+
226+
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
227+
fir::runtime::genSyncAllStatement(builder, loc, statAddr, errMsgAddr);
175228
}
176229

177230
void Fortran::lower::genSyncImagesStatement(
178231
Fortran::lower::AbstractConverter &converter,
179-
const Fortran::parser::SyncImagesStmt &) {
180-
TODO(converter.getCurrentLocation(), "coarray: SYNC IMAGES runtime");
232+
const Fortran::parser::SyncImagesStmt &stmt) {
233+
mlir::Location loc = converter.getCurrentLocation();
234+
checkCoarrayEnabled(converter, loc);
235+
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
236+
237+
// Handle STAT and ERRMSG values
238+
const std::list<Fortran::parser::StatOrErrmsg> &statOrErrList =
239+
std::get<std::list<Fortran::parser::StatOrErrmsg>>(stmt.t);
240+
auto [statAddr, errMsgAddr] = getStatAndErrmsg(converter, loc, statOrErrList);
241+
242+
// SYNC_IMAGES(*) is passed as count == -1 while SYNC IMAGES([]) hase count
243+
// == 0. Note further that SYNC IMAGES(*) is not semantically equivalent to
244+
// SYNC ALL.
245+
Fortran::lower::StatementContext stmtCtx;
246+
mlir::Value imageSet;
247+
const Fortran::parser::SyncImagesStmt::ImageSet &imgSet =
248+
std::get<Fortran::parser::SyncImagesStmt::ImageSet>(stmt.t);
249+
std::visit(Fortran::common::visitors{
250+
[&](const Fortran::parser::IntExpr &intExpr) {
251+
const SomeExpr *expr = Fortran::semantics::GetExpr(intExpr);
252+
imageSet =
253+
fir::getBase(converter.genExprBox(loc, *expr, stmtCtx));
254+
},
255+
[&](const Fortran::parser::Star &) {
256+
imageSet = builder.create<fir::AbsentOp>(
257+
loc, fir::BoxType::get(fir::SequenceType::get(
258+
{fir::SequenceType::getUnknownExtent()},
259+
builder.getI32Type())));
260+
}},
261+
imgSet.u);
262+
263+
fir::runtime::genSyncImagesStatement(builder, loc, imageSet, statAddr,
264+
errMsgAddr);
181265
}
182266

183267
void Fortran::lower::genSyncMemoryStatement(
184268
Fortran::lower::AbstractConverter &converter,
185-
const Fortran::parser::SyncMemoryStmt &) {
186-
TODO(converter.getCurrentLocation(), "coarray: SYNC MEMORY runtime");
269+
const Fortran::parser::SyncMemoryStmt &stmt) {
270+
mlir::Location loc = converter.getCurrentLocation();
271+
checkCoarrayEnabled(converter, loc);
272+
273+
// Handle STAT and ERRMSG values
274+
const std::list<Fortran::parser::StatOrErrmsg> &statOrErrList = stmt.v;
275+
auto [statAddr, errMsgAddr] = getStatAndErrmsg(converter, loc, statOrErrList);
276+
277+
fir::FirOpBuilder &builder = converter.getFirOpBuilder();
278+
fir::runtime::genSyncMemoryStatement(builder, loc, statAddr, errMsgAddr);
187279
}
188280

189281
void Fortran::lower::genSyncTeamStatement(

flang/lib/Optimizer/Builder/Runtime/Coarray.cpp

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,24 @@
1414
using namespace Fortran::runtime;
1515
using namespace Fortran::semantics;
1616

17+
// Most PRIF functions take `errmsg` and `errmsg_alloc` as two optional
18+
// arguments of intent (out). One is allocatable, the other is not.
19+
// It is the responsibility of the compiler to ensure that the appropriate
20+
// optional argument is passed, and at most one must be provided in a given
21+
// call.
22+
// Depending on the type of `errmsg`, this function will return the pair
23+
// corresponding to (`errmsg`, `errmsg_alloc`).
24+
static std::pair<mlir::Value, mlir::Value>
25+
genErrmsgPRIF(fir::FirOpBuilder &builder, mlir::Location loc,
26+
mlir::Value errmsg) {
27+
bool isAllocatableErrmsg = fir::isAllocatableType(errmsg.getType());
28+
29+
mlir::Value absent = builder.create<fir::AbsentOp>(loc, PRIF_ERRMSG_TYPE);
30+
mlir::Value errMsg = isAllocatableErrmsg ? absent : errmsg;
31+
mlir::Value errMsgAlloc = isAllocatableErrmsg ? errmsg : absent;
32+
return {errMsg, errMsgAlloc};
33+
}
34+
1735
/// Generate Call to runtime prif_init
1836
mlir::Value fir::runtime::genInitCoarray(fir::FirOpBuilder &builder,
1937
mlir::Location loc) {
@@ -84,3 +102,64 @@ mlir::Value fir::runtime::getThisImage(fir::FirOpBuilder &builder,
84102
builder.create<fir::CallOp>(loc, funcOp, args);
85103
return builder.create<fir::LoadOp>(loc, result);
86104
}
105+
106+
/// Generate call to runtime subroutine prif_sync_all
107+
void fir::runtime::genSyncAllStatement(fir::FirOpBuilder &builder,
108+
mlir::Location loc, mlir::Value stat,
109+
mlir::Value errmsg) {
110+
mlir::FunctionType ftype =
111+
PRIF_FUNCTYPE(PRIF_STAT_TYPE, PRIF_ERRMSG_TYPE, PRIF_ERRMSG_TYPE);
112+
mlir::func::FuncOp funcOp =
113+
builder.createFunction(loc, PRIFNAME_SUB("sync_all"), ftype);
114+
115+
auto [errmsgArg, errmsgAllocArg] = genErrmsgPRIF(builder, loc, errmsg);
116+
llvm::SmallVector<mlir::Value> args = fir::runtime::createArguments(
117+
builder, loc, ftype, stat, errmsgArg, errmsgAllocArg);
118+
builder.create<fir::CallOp>(loc, funcOp, args);
119+
}
120+
121+
/// Generate call to runtime subroutine prif_sync_memory
122+
void fir::runtime::genSyncMemoryStatement(fir::FirOpBuilder &builder,
123+
mlir::Location loc, mlir::Value stat,
124+
mlir::Value errmsg) {
125+
mlir::FunctionType ftype =
126+
PRIF_FUNCTYPE(PRIF_STAT_TYPE, PRIF_ERRMSG_TYPE, PRIF_ERRMSG_TYPE);
127+
mlir::func::FuncOp funcOp =
128+
builder.createFunction(loc, PRIFNAME_SUB("sync_memory"), ftype);
129+
130+
auto [errmsgArg, errmsgAllocArg] = genErrmsgPRIF(builder, loc, errmsg);
131+
llvm::SmallVector<mlir::Value> args = fir::runtime::createArguments(
132+
builder, loc, ftype, stat, errmsgArg, errmsgAllocArg);
133+
builder.create<fir::CallOp>(loc, funcOp, args);
134+
}
135+
136+
/// Generate call to runtime subroutine prif_sync_images
137+
void fir::runtime::genSyncImagesStatement(fir::FirOpBuilder &builder,
138+
mlir::Location loc,
139+
mlir::Value imageSet,
140+
mlir::Value stat,
141+
mlir::Value errmsg) {
142+
mlir::Type imgSetTy = fir::BoxType::get(fir::SequenceType::get(
143+
{fir::SequenceType::getUnknownExtent()}, builder.getI32Type()));
144+
mlir::FunctionType ftype = PRIF_FUNCTYPE(imgSetTy, PRIF_STAT_TYPE,
145+
PRIF_ERRMSG_TYPE, PRIF_ERRMSG_TYPE);
146+
mlir::func::FuncOp funcOp =
147+
builder.createFunction(loc, PRIFNAME_SUB("sync_images"), ftype);
148+
149+
// If imageSet is scalar, PRIF require to pass an array of size 1.
150+
if (auto boxTy = mlir::dyn_cast<fir::BoxType>(imageSet.getType())) {
151+
if (!mlir::isa<fir::SequenceType>(boxTy.getEleTy())) {
152+
mlir::Value one =
153+
builder.createIntegerConstant(loc, builder.getI32Type(), 1);
154+
mlir::Value shape = fir::ShapeOp::create(builder, loc, one);
155+
imageSet = fir::ReboxOp::create(
156+
builder, loc,
157+
fir::BoxType::get(fir::SequenceType::get({1}, builder.getI32Type())),
158+
imageSet, shape, mlir::Value{});
159+
}
160+
}
161+
auto [errmsgArg, errmsgAllocArg] = genErrmsgPRIF(builder, loc, errmsg);
162+
llvm::SmallVector<mlir::Value> args = fir::runtime::createArguments(
163+
builder, loc, ftype, imageSet, stat, errmsgArg, errmsgAllocArg);
164+
builder.create<fir::CallOp>(loc, funcOp, args);
165+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
! RUN: %flang_fc1 -emit-hlfir -fcoarray %s -o - | FileCheck %s --check-prefixes=COARRAY
2+
! RUN2: not %flang_fc1 -emit-hlfir %s -o - | FileCheck %s --check-prefixes=NOCOARRAY
3+
4+
program test_sync_all
5+
implicit none
6+
! NOCOARRAY: Coarrays disabled, use '-fcoarray' to enable.
7+
8+
! COARRAY: %[[ERRMSG:.*]]:2 = hlfir.declare %[[VAL_1:.*]] typeparams %[[C_128:.*]] {uniq_name = "_QFEerror_message"} : (!fir.ref<!fir.char<1,128>>, index) -> (!fir.ref<!fir.char<1,128>>, !fir.ref<!fir.char<1,128>>)
9+
! COARRAY: %[[STAT:.*]]:2 = hlfir.declare %[[VAL_2:.*]] {uniq_name = "_QFEsync_status"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
10+
integer sync_status
11+
character(len=128) :: error_message
12+
13+
! COARRAY: %[[VAL_3:.*]] = fir.absent !fir.ref<i32>
14+
! COARRAY: %[[VAL_4:.*]] = fir.absent !fir.box<!fir.char<1,?>>
15+
! COARRAY: %[[VAL_5:.*]] = fir.absent !fir.box<!fir.char<1,?>>
16+
! COARRAY: fir.call @_QMprifPprif_sync_all(%[[VAL_3]], %[[VAL_4]], %[[VAL_5]]) fastmath<contract> : (!fir.ref<i32>, !fir.box<!fir.char<1,?>>, !fir.box<!fir.char<1,?>>) -> ()
17+
sync all
18+
19+
! COARRAY: %[[VAL_6:.*]] = fir.absent !fir.box<!fir.char<1,?>>
20+
! COARRAY: %[[VAL_7:.*]] = fir.absent !fir.box<!fir.char<1,?>>
21+
! COARRAY: fir.call @_QMprifPprif_sync_all(%[[STAT]]#0, %[[VAL_6]], %[[VAL_7]]) fastmath<contract> : (!fir.ref<i32>, !fir.box<!fir.char<1,?>>, !fir.box<!fir.char<1,?>>) -> ()
22+
sync all(stat=sync_status)
23+
24+
! COARRAY: %[[VAL_8:.*]] = fir.embox %[[ERRMSG]]#0 : (!fir.ref<!fir.char<1,128>>) -> !fir.box<!fir.char<1,128>>
25+
! COARRAY: %[[VAL_9:.*]] = fir.absent !fir.ref<i32>
26+
! COARRAY: %[[VAL_10:.*]] = fir.absent !fir.box<!fir.char<1,?>>
27+
! COARRAY: %[[VAL_11:.*]] = fir.convert %[[VAL_8]] : (!fir.box<!fir.char<1,128>>) -> !fir.box<!fir.char<1,?>>
28+
! COARRAY: fir.call @_QMprifPprif_sync_all(%[[VAL_9]], %[[VAL_11]], %[[VAL_10]]) fastmath<contract> : (!fir.ref<i32>, !fir.box<!fir.char<1,?>>, !fir.box<!fir.char<1,?>>) -> ()
29+
sync all( errmsg=error_message)
30+
31+
! COARRAY: %[[VAL_12:.*]] = fir.embox %[[ERRMSG]]#0 : (!fir.ref<!fir.char<1,128>>) -> !fir.box<!fir.char<1,128>>
32+
! COARRAY: %[[VAL_13:.*]] = fir.absent !fir.box<!fir.char<1,?>>
33+
! COARRAY: %[[VAL_14:.*]] = fir.convert %[[VAL_12]] : (!fir.box<!fir.char<1,128>>) -> !fir.box<!fir.char<1,?>>
34+
! COARRAY: fir.call @_QMprifPprif_sync_all(%[[STAT]]#0, %[[VAL_14]], %[[VAL_13]]) fastmath<contract> : (!fir.ref<i32>, !fir.box<!fir.char<1,?>>, !fir.box<!fir.char<1,?>>) -> ()
35+
sync all(stat=sync_status, errmsg=error_message)
36+
37+
end program test_sync_all
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
! RUN: %flang_fc1 -emit-hlfir -fcoarray %s -o - | FileCheck %s --check-prefixes=COARRAY
2+
! RUN2: not %flang_fc1 -emit-hlfir %s -o - | FileCheck %s --check-prefixes=NOCOARRAY
3+
4+
program test_sync_images
5+
implicit none
6+
! NOCOARRAY: Coarrays disabled, use '-fcoarray' to enable.
7+
8+
! COARRAY: %[[ERRMSG:.*]]:2 = hlfir.declare %[[VAL_1:.*]] typeparams %[[C_128:.*]] {uniq_name = "_QFEerror_message"} : (!fir.ref<!fir.char<1,128>>, index) -> (!fir.ref<!fir.char<1,128>>, !fir.ref<!fir.char<1,128>>)
9+
! COARRAY: %[[ME:.*]]:2 = hlfir.declare %[[VAL_3:.*]] {uniq_name = "_QFEme"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
10+
! COARRAY: %[[STAT:.*]]:2 = hlfir.declare %[[VAL_2:.*]] {uniq_name = "_QFEsync_status"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
11+
integer sync_status, me
12+
character(len=128) :: error_message
13+
14+
! COARRAY: %[[VAL_1:.*]] = fir.embox %[[ERRMSG]]#0 : (!fir.ref<!fir.char<1,128>>) -> !fir.box<!fir.char<1,128>>
15+
! COARRAY: %[[VAL_2:.*]] = fir.absent !fir.box<!fir.array<?xi32>>
16+
! COARRAY: %[[VAL_3:.*]] = fir.absent !fir.box<!fir.char<1,?>>
17+
! COARRAY: %[[VAL_4:.*]] = fir.convert %[[VAL_1]] : (!fir.box<!fir.char<1,128>>) -> !fir.box<!fir.char<1,?>>
18+
! COARRAY: fir.call @_QMprifPprif_sync_images(%[[VAL_2]], %[[STAT]]#0, %[[VAL_4]], %[[VAL_3]]) fastmath<contract> : (!fir.box<!fir.array<?xi32>>, !fir.ref<i32>, !fir.box<!fir.char<1,?>>, !fir.box<!fir.char<1,?>>) -> ()
19+
sync images(*, stat=sync_status, errmsg=error_message)
20+
21+
! COARRAY: %[[VAL_5:.*]] = fir.embox %[[ERRMSG]]#0 : (!fir.ref<!fir.char<1,128>>) -> !fir.box<!fir.char<1,128>>
22+
! COARRAY: %[[VAL_6:.*]] = fir.embox %[[ME]]#0 : (!fir.ref<i32>) -> !fir.box<i32>
23+
! COARRAY: %[[VAL_7:.*]] = fir.rebox %[[VAL_6]](%[[SHAPE:.*]]) : (!fir.box<i32>, !fir.shape<1>) -> !fir.box<!fir.array<1xi32>>
24+
! COARRAY: %[[VAL_8:.*]] = fir.absent !fir.box<!fir.char<1,?>>
25+
! COARRAY: %[[VAL_9:.*]] = fir.convert %[[VAL_7]] : (!fir.box<!fir.array<1xi32>>) -> !fir.box<!fir.array<?xi32>>
26+
! COARRAY: %[[VAL_10:.*]] = fir.convert %[[VAL_5]] : (!fir.box<!fir.char<1,128>>) -> !fir.box<!fir.char<1,?>>
27+
! COARRAY: fir.call @_QMprifPprif_sync_images(%[[VAL_9]], %[[STAT]]#0, %[[VAL_10]], %[[VAL_8]]) fastmath<contract> : (!fir.box<!fir.array<?xi32>>, !fir.ref<i32>, !fir.box<!fir.char<1,?>>, !fir.box<!fir.char<1,?>>) -> ()
28+
sync images(me, stat=sync_status, errmsg=error_message)
29+
30+
! COARRAY: %[[VAL_11:.*]] = fir.embox %[[ERRMSG]]#0 : (!fir.ref<!fir.char<1,128>>) -> !fir.box<!fir.char<1,128>>
31+
! COARRAY: %[[VAL_12:.*]] = fir.embox %[[IMG_SET:.*]]#0(%[[SHAPE_1:.*]]) : (!fir.ref<!fir.array<1xi32>>, !fir.shape<1>) -> !fir.box<!fir.array<1xi32>>
32+
! COARRAY: %[[VAL_13:.*]] = fir.absent !fir.box<!fir.char<1,?>>
33+
! COARRAY: %[[VAL_14:.*]] = fir.convert %[[VAL_12]] : (!fir.box<!fir.array<1xi32>>) -> !fir.box<!fir.array<?xi32>>
34+
! COARRAY: %[[VAL_15:.*]] = fir.convert %[[VAL_11]] : (!fir.box<!fir.char<1,128>>) -> !fir.box<!fir.char<1,?>>
35+
! COARRAY: fir.call @_QMprifPprif_sync_images(%[[VAL_14]], %[[STAT]]#0, %[[VAL_15]], %[[VAL_13]]) fastmath<contract> : (!fir.box<!fir.array<?xi32>>, !fir.ref<i32>, !fir.box<!fir.char<1,?>>, !fir.box<!fir.char<1,?>>) -> ()
36+
sync images([1], stat=sync_status, errmsg=error_message)
37+
38+
! COARRAY: %[[VAL_17:.*]] = fir.absent !fir.ref<i32>
39+
! COARRAY: %[[VAL_18:.*]] = fir.absent !fir.box<!fir.char<1,?>>
40+
! COARRAY: %[[VAL_19:.*]] = fir.absent !fir.box<!fir.array<?xi32>>
41+
! COARRAY: %[[VAL_20:.*]] = fir.absent !fir.box<!fir.char<1,?>>
42+
! COARRAY: fir.call @_QMprifPprif_sync_images(%[[VAL_19]], %[[VAL_17]], %[[VAL_18]], %[[VAL_20]]) fastmath<contract> : (!fir.box<!fir.array<?xi32>>, !fir.ref<i32>, !fir.box<!fir.char<1,?>>, !fir.box<!fir.char<1,?>>) -> ()
43+
sync images(*)
44+
45+
! COARRAY: %[[VAL_23:.*]] = fir.absent !fir.ref<i32>
46+
! COARRAY: %[[VAL_24:.*]] = fir.absent !fir.box<!fir.char<1,?>>
47+
! COARRAY: %[[VAL_21:.*]] = fir.embox %[[ME]]#0 : (!fir.ref<i32>) -> !fir.box<i32>
48+
! COARRAY: %[[VAL_22:.*]] = fir.rebox %[[VAL_21]](%[[SHAPE_2:.*]]) : (!fir.box<i32>, !fir.shape<1>) -> !fir.box<!fir.array<1xi32>>
49+
! COARRAY: %[[VAL_25:.*]] = fir.absent !fir.box<!fir.char<1,?>>
50+
! COARRAY: %[[VAL_26:.*]] = fir.convert %[[VAL_22]] : (!fir.box<!fir.array<1xi32>>) -> !fir.box<!fir.array<?xi32>>
51+
! COARRAY: fir.call @_QMprifPprif_sync_images(%[[VAL_26]], %[[VAL_23]], %[[VAL_24]], %[[VAL_25]]) fastmath<contract> : (!fir.box<!fir.array<?xi32>>, !fir.ref<i32>, !fir.box<!fir.char<1,?>>, !fir.box<!fir.char<1,?>>) -> ()
52+
sync images(me)
53+
54+
! COARRAY: %[[VAL_28:.*]] = fir.absent !fir.ref<i32>
55+
! COARRAY: %[[VAL_29:.*]] = fir.absent !fir.box<!fir.char<1,?>>
56+
! COARRAY: %[[VAL_27:.*]] = fir.embox %[[IMG_SET:.*]]#0(%[[SHAPE_3:.*]]) : (!fir.ref<!fir.array<1xi32>>, !fir.shape<1>) -> !fir.box<!fir.array<1xi32>>
57+
! COARRAY: %[[VAL_30:.*]] = fir.absent !fir.box<!fir.char<1,?>>
58+
! COARRAY: %[[VAL_31:.*]] = fir.convert %[[VAL_27]] : (!fir.box<!fir.array<1xi32>>) -> !fir.box<!fir.array<?xi32>>
59+
! COARRAY: fir.call @_QMprifPprif_sync_images(%[[VAL_31]], %[[VAL_28]], %[[VAL_29]], %[[VAL_30]]) fastmath<contract> : (!fir.box<!fir.array<?xi32>>, !fir.ref<i32>, !fir.box<!fir.char<1,?>>, !fir.box<!fir.char<1,?>>) -> ()
60+
sync images([1])
61+
62+
end program test_sync_images

0 commit comments

Comments
 (0)