Skip to content

Commit 364fe55

Browse files
authored
[flang] simplify pointer assignments (#168732)
Pointer assignment lowering was done in different ways depending on contexts and types, sometimes still using runtime calls when this is not needed and the complexity of doing this inline is very limited (the pointer and target descriptors were already prepared inline, the runtime is just doing the descriptor assignment and ensuring the pointer descriptor keep its pointer flag). Slightly extent the inline version that was used for Forall and use it for all cases. When lowering without HLFIR is removed, this will allow removing more code.
1 parent a9a14d6 commit 364fe55

File tree

10 files changed

+395
-329
lines changed

10 files changed

+395
-329
lines changed

flang/lib/Lower/Bridge.cpp

Lines changed: 59 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -4813,40 +4813,22 @@ class FirConverter : public Fortran::lower::AbstractConverter {
48134813

48144814
// Generate pointer assignment with possibly empty bounds-spec. R1035: a
48154815
// bounds-spec is a lower bound value.
4816-
void genPointerAssignment(
4816+
void genNoHLFIRPointerAssignment(
48174817
mlir::Location loc, const Fortran::evaluate::Assignment &assign,
48184818
const Fortran::evaluate::Assignment::BoundsSpec &lbExprs) {
48194819
Fortran::lower::StatementContext stmtCtx;
48204820

4821-
if (!lowerToHighLevelFIR() &&
4822-
Fortran::evaluate::IsProcedureDesignator(assign.rhs))
4821+
assert(!lowerToHighLevelFIR() && "code should not be called with HFLIR");
4822+
if (Fortran::evaluate::IsProcedureDesignator(assign.rhs))
48234823
TODO(loc, "procedure pointer assignment");
4824-
if (Fortran::evaluate::IsProcedurePointer(assign.lhs)) {
4825-
hlfir::Entity lhs = Fortran::lower::convertExprToHLFIR(
4826-
loc, *this, assign.lhs, localSymbols, stmtCtx);
4827-
if (Fortran::evaluate::UnwrapExpr<Fortran::evaluate::NullPointer>(
4828-
assign.rhs)) {
4829-
// rhs is null(). rhs being null(pptr) is handled in genNull.
4830-
auto boxTy{
4831-
Fortran::lower::getUntypedBoxProcType(builder->getContext())};
4832-
hlfir::Entity rhs(
4833-
fir::factory::createNullBoxProc(*builder, loc, boxTy));
4834-
builder->createStoreWithConvert(loc, rhs, lhs);
4835-
return;
4836-
}
4837-
hlfir::Entity rhs(getBase(Fortran::lower::convertExprToAddress(
4838-
loc, *this, assign.rhs, localSymbols, stmtCtx)));
4839-
builder->createStoreWithConvert(loc, rhs, lhs);
4840-
return;
4841-
}
48424824

48434825
std::optional<Fortran::evaluate::DynamicType> lhsType =
48444826
assign.lhs.GetType();
48454827
// Delegate pointer association to unlimited polymorphic pointer
48464828
// to the runtime. element size, type code, attribute and of
48474829
// course base_addr might need to be updated.
48484830
if (lhsType && lhsType->IsPolymorphic()) {
4849-
if (!lowerToHighLevelFIR() && explicitIterationSpace())
4831+
if (explicitIterationSpace())
48504832
TODO(loc, "polymorphic pointer assignment in FORALL");
48514833
llvm::SmallVector<mlir::Value> lbounds;
48524834
for (const Fortran::evaluate::ExtentExpr &lbExpr : lbExprs)
@@ -4873,7 +4855,7 @@ class FirConverter : public Fortran::lower::AbstractConverter {
48734855
llvm::SmallVector<mlir::Value> lbounds;
48744856
for (const Fortran::evaluate::ExtentExpr &lbExpr : lbExprs)
48754857
lbounds.push_back(fir::getBase(genExprValue(toEvExpr(lbExpr), stmtCtx)));
4876-
if (!lowerToHighLevelFIR() && explicitIterationSpace()) {
4858+
if (explicitIterationSpace()) {
48774859
// Pointer assignment in FORALL context. Copy the rhs box value
48784860
// into the lhs box variable.
48794861
genArrayAssignment(assign, stmtCtx, lbounds);
@@ -4884,6 +4866,21 @@ class FirConverter : public Fortran::lower::AbstractConverter {
48844866
stmtCtx);
48854867
}
48864868

4869+
void genPointerAssignment(mlir::Location loc,
4870+
const Fortran::evaluate::Assignment &assign) {
4871+
if (isInsideHlfirForallOrWhere()) {
4872+
// Generate Pointer assignment as hlfir.region_assign.
4873+
genForallPointerAssignment(loc, assign);
4874+
return;
4875+
}
4876+
Fortran::lower::StatementContext stmtCtx;
4877+
hlfir::Entity lhs = Fortran::lower::convertExprToHLFIR(
4878+
loc, *this, assign.lhs, localSymbols, stmtCtx);
4879+
mlir::Value rhs = genPointerAssignmentRhs(loc, lhs, assign, stmtCtx);
4880+
builder->createStoreWithConvert(loc, rhs, lhs);
4881+
cuf::genPointerSync(lhs, *builder);
4882+
}
4883+
48874884
void genForallPointerAssignment(mlir::Location loc,
48884885
const Fortran::evaluate::Assignment &assign) {
48894886
// Lower pointer assignment inside forall with hlfir.region_assign with
@@ -4904,8 +4901,7 @@ class FirConverter : public Fortran::lower::AbstractConverter {
49044901
// Lower RHS in its own region.
49054902
builder->createBlock(&regionAssignOp.getRhsRegion());
49064903
Fortran::lower::StatementContext rhsContext;
4907-
mlir::Value rhs =
4908-
genForallPointerAssignmentRhs(loc, lhs, assign, rhsContext);
4904+
mlir::Value rhs = genPointerAssignmentRhs(loc, lhs, assign, rhsContext);
49094905
auto rhsYieldOp = hlfir::YieldOp::create(*builder, loc, rhs);
49104906
Fortran::lower::genCleanUpInRegionIfAny(
49114907
loc, *builder, rhsYieldOp.getCleanup(), rhsContext);
@@ -4921,9 +4917,9 @@ class FirConverter : public Fortran::lower::AbstractConverter {
49214917
}
49224918

49234919
mlir::Value
4924-
genForallPointerAssignmentRhs(mlir::Location loc, mlir::Value lhs,
4925-
const Fortran::evaluate::Assignment &assign,
4926-
Fortran::lower::StatementContext &rhsContext) {
4920+
genPointerAssignmentRhs(mlir::Location loc, hlfir::Entity lhs,
4921+
const Fortran::evaluate::Assignment &assign,
4922+
Fortran::lower::StatementContext &rhsContext) {
49274923
if (Fortran::evaluate::IsProcedureDesignator(assign.lhs)) {
49284924
if (Fortran::evaluate::UnwrapExpr<Fortran::evaluate::NullPointer>(
49294925
assign.rhs))
@@ -4935,11 +4931,34 @@ class FirConverter : public Fortran::lower::AbstractConverter {
49354931
// Data target.
49364932
auto lhsBoxType =
49374933
llvm::cast<fir::BaseBoxType>(fir::unwrapRefType(lhs.getType()));
4938-
// For NULL, create disassociated descriptor whose dynamic type is
4939-
// the static type of the LHS.
4934+
// For NULL, create disassociated descriptor whose dynamic type is the
4935+
// static type of the LHS (fulfills 7.3.2.3 requirements that the dynamic
4936+
// type of a deallocated polymorphic pointer is its static type).
49404937
if (Fortran::evaluate::UnwrapExpr<Fortran::evaluate::NullPointer>(
4941-
assign.rhs))
4942-
return fir::factory::createUnallocatedBox(*builder, loc, lhsBoxType, {});
4938+
assign.rhs)) {
4939+
llvm::SmallVector<mlir::Value, 1> nonDeferredLenParams;
4940+
if (auto lhsVar =
4941+
llvm::dyn_cast_if_present<fir::FortranVariableOpInterface>(
4942+
lhs.getDefiningOp()))
4943+
nonDeferredLenParams = lhsVar.getExplicitTypeParams();
4944+
if (isInsideHlfirForallOrWhere()) {
4945+
// Inside FORALL, the non deferred type parameters may only be
4946+
// accessible in the hlfir.region_assign lhs region if they were
4947+
// computed there.
4948+
for (mlir::Value &param : nonDeferredLenParams)
4949+
if (!param.getParentRegion()->isAncestor(
4950+
builder->getBlock()->getParent())) {
4951+
if (llvm::isa_and_nonnull<mlir::arith::ConstantOp>(
4952+
param.getDefiningOp()))
4953+
param = builder->clone(*param.getDefiningOp())->getResult(0);
4954+
else
4955+
TODO(loc, "Pointer assignment with non deferred type parameter "
4956+
"inside FORALL");
4957+
}
4958+
}
4959+
return fir::factory::createUnallocatedBox(*builder, loc, lhsBoxType,
4960+
nonDeferredLenParams);
4961+
}
49434962
hlfir::Entity rhs = Fortran::lower::convertExprToHLFIR(
49444963
loc, *this, assign.rhs, localSymbols, rhsContext);
49454964
auto rhsBoxType = rhs.getBoxType();
@@ -5032,9 +5051,10 @@ class FirConverter : public Fortran::lower::AbstractConverter {
50325051

50335052
// Pointer assignment with bounds-remapping. R1036: a bounds-remapping is a
50345053
// pair, lower bound and upper bound.
5035-
void genPointerAssignment(
5054+
void genNoHLFIRPointerAssignment(
50365055
mlir::Location loc, const Fortran::evaluate::Assignment &assign,
50375056
const Fortran::evaluate::Assignment::BoundsRemapping &boundExprs) {
5057+
assert(!lowerToHighLevelFIR() && "code should not be called with HFLIR");
50385058
Fortran::lower::StatementContext stmtCtx;
50395059
llvm::SmallVector<mlir::Value> lbounds;
50405060
llvm::SmallVector<mlir::Value> ubounds;
@@ -5053,7 +5073,7 @@ class FirConverter : public Fortran::lower::AbstractConverter {
50535073
// Polymorphic lhs/rhs need more care. See F2018 10.2.2.3.
50545074
if ((lhsType && lhsType->IsPolymorphic()) ||
50555075
(rhsType && rhsType->IsPolymorphic())) {
5056-
if (!lowerToHighLevelFIR() && explicitIterationSpace())
5076+
if (explicitIterationSpace())
50575077
TODO(loc, "polymorphic pointer assignment in FORALL");
50585078

50595079
fir::MutableBoxValue lhsMutableBox = genExprMutableBox(loc, assign.lhs);
@@ -5071,7 +5091,7 @@ class FirConverter : public Fortran::lower::AbstractConverter {
50715091
rhsType->IsPolymorphic());
50725092
return;
50735093
}
5074-
if (!lowerToHighLevelFIR() && explicitIterationSpace()) {
5094+
if (explicitIterationSpace()) {
50755095
// Pointer assignment in FORALL context. Copy the rhs box value
50765096
// into the lhs box variable.
50775097
genArrayAssignment(assign, stmtCtx, lbounds, ubounds);
@@ -5083,13 +5103,6 @@ class FirConverter : public Fortran::lower::AbstractConverter {
50835103
fir::factory::disassociateMutableBox(*builder, loc, lhs);
50845104
return;
50855105
}
5086-
if (lowerToHighLevelFIR()) {
5087-
fir::ExtendedValue rhs = genExprAddr(assign.rhs, stmtCtx);
5088-
fir::factory::associateMutableBoxWithRemap(*builder, loc, lhs, rhs,
5089-
lbounds, ubounds);
5090-
return;
5091-
}
5092-
// Legacy lowering below.
50935106
// Do not generate a temp in case rhs is an array section.
50945107
fir::ExtendedValue rhs =
50955108
Fortran::lower::isArraySectionWithoutVectorSubscript(assign.rhs)
@@ -5479,18 +5492,10 @@ class FirConverter : public Fortran::lower::AbstractConverter {
54795492
dirs);
54805493
},
54815494
[&](const Fortran::evaluate::Assignment::BoundsSpec &lbExprs) {
5482-
if (isInsideHlfirForallOrWhere())
5483-
genForallPointerAssignment(loc, assign);
5484-
else
5485-
genPointerAssignment(loc, assign, lbExprs);
5495+
genPointerAssignment(loc, assign);
54865496
},
54875497
[&](const Fortran::evaluate::Assignment::BoundsRemapping
5488-
&boundExprs) {
5489-
if (isInsideHlfirForallOrWhere())
5490-
genForallPointerAssignment(loc, assign);
5491-
else
5492-
genPointerAssignment(loc, assign, boundExprs);
5493-
},
5498+
&boundExprs) { genPointerAssignment(loc, assign); },
54945499
},
54955500
assign.u);
54965501
return;
@@ -5692,11 +5697,11 @@ class FirConverter : public Fortran::lower::AbstractConverter {
56925697
},
56935698

56945699
[&](const Fortran::evaluate::Assignment::BoundsSpec &lbExprs) {
5695-
return genPointerAssignment(loc, assign, lbExprs);
5700+
return genNoHLFIRPointerAssignment(loc, assign, lbExprs);
56965701
},
56975702
[&](const Fortran::evaluate::Assignment::BoundsRemapping
56985703
&boundExprs) {
5699-
return genPointerAssignment(loc, assign, boundExprs);
5704+
return genNoHLFIRPointerAssignment(loc, assign, boundExprs);
57005705
},
57015706
},
57025707
assign.u);

flang/lib/Optimizer/Builder/HLFIRTools.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,9 @@ hlfir::Entity hlfir::genVariableBox(mlir::Location loc,
402402
fir::BoxType::get(var.getElementOrSequenceType(), isVolatile);
403403
if (forceBoxType) {
404404
boxType = forceBoxType;
405-
mlir::Type baseType =
406-
fir::ReferenceType::get(fir::unwrapRefType(forceBoxType.getEleTy()));
407-
addr = builder.createConvert(loc, baseType, addr);
405+
mlir::Type baseType = fir::ReferenceType::get(
406+
fir::unwrapRefType(forceBoxType.getEleTy()), forceBoxType.isVolatile());
407+
addr = builder.createConvertWithVolatileCast(loc, baseType, addr);
408408
}
409409
auto embox = fir::EmboxOp::create(builder, loc, boxType, addr, shape,
410410
/*slice=*/mlir::Value{}, typeParams);

flang/test/Lower/HLFIR/allocatable-and-pointer-status-change.f90

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ subroutine pointer_assignment(p, ziel)
3434
! CHECK: %[[VAL_6:.*]]:2 = hlfir.declare %[[VAL_1:[a-z0-9]*]](%[[VAL_5:[a-z0-9]*]]) dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {fortran_attrs = #fir.var_attrs<target>, {{.*}}Eziel
3535
p => ziel
3636
! CHECK: %[[VAL_7:.*]] = fir.shift %[[VAL_4:.*]] : (index) -> !fir.shift<1>
37-
! CHECK: %[[VAL_8:.*]] = fir.rebox %[[VAL_6]]#1(%[[VAL_7]]) : (!fir.box<!fir.array<?xf32>>, !fir.shift<1>) -> !fir.box<!fir.ptr<!fir.array<?xf32>>>
37+
! CHECK: %[[VAL_8:.*]] = fir.rebox %[[VAL_6]]#0(%[[VAL_7]]) : (!fir.box<!fir.array<?xf32>>, !fir.shift<1>) -> !fir.box<!fir.ptr<!fir.array<?xf32>>>
3838
! CHECK: fir.store %[[VAL_8]] to %[[VAL_2]]#0 : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>
3939
p => ziel(42:77:3)
4040
! CHECK: %[[VAL_14:.*]] = hlfir.designate %{{.*}}#0 (%{{.*}}:%{{.*}}:%{{.*}}) shape %{{.*}} : (!fir.box<!fir.array<?xf32>>, index, index, index, !fir.shape<1>) -> !fir.box<!fir.array<12xf32>>
@@ -49,27 +49,29 @@ subroutine pointer_remapping(p, ziel)
4949
! CHECK: %[[VAL_2:.*]]:2 = hlfir.declare %[[VAL_0:[a-z0-9]*]] dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {fortran_attrs = #fir.var_attrs<pointer>, {{.*}}Ep
5050
! CHECK: %[[VAL_7:.*]]:2 = hlfir.declare %[[VAL_1:[a-z0-9]*]](%[[VAL_6:[a-z0-9]*]]) dummy_scope %{{[0-9]+}} arg {{[0-9]+}} {fortran_attrs = #fir.var_attrs<target>, {{.*}}Eziel
5151
p(2:7, 3:102) => ziel
52-
! CHECK: %[[VAL_8:.*]] = arith.constant 2 : i64
53-
! CHECK: %[[VAL_9:.*]] = arith.constant 7 : i64
54-
! CHECK: %[[VAL_10:.*]] = arith.constant 3 : i64
55-
! CHECK: %[[VAL_11:.*]] = arith.constant 102 : i64
56-
! CHECK: %[[VAL_12:.*]] = arith.constant 1 : index
57-
! CHECK: %[[VAL_13:.*]] = fir.convert %[[VAL_8]] : (i64) -> index
58-
! CHECK: %[[VAL_14:.*]] = fir.convert %[[VAL_9]] : (i64) -> index
59-
! CHECK: %[[VAL_15:.*]] = arith.subi %[[VAL_14]], %[[VAL_13]] : index
60-
! CHECK: %[[VAL_16:.*]] = arith.addi %[[VAL_15]], %[[VAL_12]] : index
61-
! CHECK: %[[cmp0:.*]] = arith.cmpi sgt, %[[VAL_16]], %c0{{.*}} : index
62-
! CHECK: %[[ext0:.*]] = arith.select %[[cmp0]], %[[VAL_16]], %c0{{.*}} : index
63-
! CHECK: %[[VAL_17:.*]] = fir.convert %[[VAL_10]] : (i64) -> index
64-
! CHECK: %[[VAL_18:.*]] = fir.convert %[[VAL_11]] : (i64) -> index
65-
! CHECK: %[[VAL_19:.*]] = arith.subi %[[VAL_18]], %[[VAL_17]] : index
66-
! CHECK: %[[VAL_20:.*]] = arith.addi %[[VAL_19]], %[[VAL_12]] : index
67-
! CHECK: %[[cmp1:.*]] = arith.cmpi sgt, %[[VAL_20]], %c0{{.*}} : index
68-
! CHECK: %[[ext1:.*]] = arith.select %[[cmp1]], %[[VAL_20]], %c0{{.*}} : index
69-
! CHECK: %[[VAL_21:.*]] = fir.convert %[[VAL_7]]#0 : (!fir.ref<!fir.array<10x20x30xf32>>) -> !fir.ref<!fir.array<?x?xf32>>
70-
! CHECK: %[[VAL_22:.*]] = fir.shape_shift %[[VAL_8]], %[[ext0]], %[[VAL_10]], %[[ext1]] : (i64, index, i64, index) -> !fir.shapeshift<2>
71-
! CHECK: %[[VAL_23:.*]] = fir.embox %[[VAL_21]](%[[VAL_22]]) : (!fir.ref<!fir.array<?x?xf32>>, !fir.shapeshift<2>) -> !fir.box<!fir.ptr<!fir.array<?x?xf32>>>
72-
! CHECK: fir.store %[[VAL_23]] to %[[VAL_2]]#0 : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x?xf32>>>>
52+
! CHECK: %[[CONVERT_0:.*]] = fir.convert %[[VAL_7]]#0 : (!fir.ref<!fir.array<10x20x30xf32>>) -> !fir.ref<!fir.array<?x?x?xf32>>
53+
! CHECK: %[[EMBOX_0:.*]] = fir.embox %[[CONVERT_0]](%[[VAL_6]]) : (!fir.ref<!fir.array<?x?x?xf32>>, !fir.shape<3>) -> !fir.box<!fir.ptr<!fir.array<?x?x?xf32>>>
54+
! CHECK: %[[CONSTANT_3:.*]] = arith.constant 0 : index
55+
! CHECK: %[[CONSTANT_4:.*]] = arith.constant 1 : index
56+
! CHECK: %[[CONSTANT_5:.*]] = arith.constant 2 : i64
57+
! CHECK: %[[CONVERT_1:.*]] = fir.convert %[[CONSTANT_5]] : (i64) -> index
58+
! CHECK: %[[CONSTANT_6:.*]] = arith.constant 7 : i64
59+
! CHECK: %[[CONVERT_2:.*]] = fir.convert %[[CONSTANT_6]] : (i64) -> index
60+
! CHECK: %[[SUBI_0:.*]] = arith.subi %[[CONVERT_2]], %[[CONVERT_1]] : index
61+
! CHECK: %[[ADDI_0:.*]] = arith.addi %[[SUBI_0]], %[[CONSTANT_4]] : index
62+
! CHECK: %[[CMPI_0:.*]] = arith.cmpi sgt, %[[ADDI_0]], %[[CONSTANT_3]] : index
63+
! CHECK: %[[SELECT_0:.*]] = arith.select %[[CMPI_0]], %[[ADDI_0]], %[[CONSTANT_3]] : index
64+
! CHECK: %[[CONSTANT_7:.*]] = arith.constant 3 : i64
65+
! CHECK: %[[CONVERT_3:.*]] = fir.convert %[[CONSTANT_7]] : (i64) -> index
66+
! CHECK: %[[CONSTANT_8:.*]] = arith.constant 102 : i64
67+
! CHECK: %[[CONVERT_4:.*]] = fir.convert %[[CONSTANT_8]] : (i64) -> index
68+
! CHECK: %[[SUBI_1:.*]] = arith.subi %[[CONVERT_4]], %[[CONVERT_3]] : index
69+
! CHECK: %[[ADDI_1:.*]] = arith.addi %[[SUBI_1]], %[[CONSTANT_4]] : index
70+
! CHECK: %[[CMPI_1:.*]] = arith.cmpi sgt, %[[ADDI_1]], %[[CONSTANT_3]] : index
71+
! CHECK: %[[SELECT_1:.*]] = arith.select %[[CMPI_1]], %[[ADDI_1]], %[[CONSTANT_3]] : index
72+
! CHECK: %[[SHAPE_SHIFT_0:.*]] = fir.shape_shift %[[CONVERT_1]], %[[SELECT_0]], %[[CONVERT_3]], %[[SELECT_1]] : (index, index, index, index) -> !fir.shapeshift<2>
73+
! CHECK: %[[REBOX_0:.*]] = fir.rebox %[[EMBOX_0]](%[[SHAPE_SHIFT_0]]) : (!fir.box<!fir.ptr<!fir.array<?x?x?xf32>>>, !fir.shapeshift<2>) -> !fir.box<!fir.ptr<!fir.array<?x?xf32>>>
74+
! CHECK: fir.store %[[REBOX_0]] to %[[VAL_2]]#0 : !fir.ref<!fir.box<!fir.ptr<!fir.array<?x?xf32>>>>
7375
end subroutine
7476

7577
subroutine alloc_comp(x)
@@ -109,7 +111,7 @@ subroutine ptr_comp_assign(x, ziel)
109111
! CHECK: %[[VAL_8:.*]] = arith.constant 9 : index
110112
! CHECK: %[[VAL_9:.*]] = hlfir.designate %[[VAL_4]]#0 (%[[VAL_8]]) : (!fir.ref<!fir.array<10x!fir.type<_QFptr_comp_assignTt{p:!fir.box<!fir.ptr<!fir.array<?xf32>>>}>>>, index) -> !fir.ref<!fir.type<_QFptr_comp_assignTt{p:!fir.box<!fir.ptr<!fir.array<?xf32>>>}>>
111113
! CHECK: %[[VAL_10:.*]] = hlfir.designate %[[VAL_9]]{"p"} {fortran_attrs = #fir.var_attrs<pointer>} : (!fir.ref<!fir.type<_QFptr_comp_assignTt{p:!fir.box<!fir.ptr<!fir.array<?xf32>>>}>>) -> !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>
112-
! CHECK: %[[VAL_11:.*]] = fir.shape %[[VAL_5]] : (index) -> !fir.shape<1>
113-
! CHECK: %[[VAL_12:.*]] = fir.embox %[[VAL_7]]#0(%[[VAL_11]]) : (!fir.ref<!fir.array<100xf32>>, !fir.shape<1>) -> !fir.box<!fir.ptr<!fir.array<?xf32>>>
114+
! CHECK: %[[CAST:.*]] = fir.convert %[[VAL_7]]#0 : (!fir.ref<!fir.array<100xf32>>) -> !fir.ref<!fir.array<?xf32>>
115+
! CHECK: %[[VAL_12:.*]] = fir.embox %[[CAST]](%[[VAL_6]]) : (!fir.ref<!fir.array<?xf32>>, !fir.shape<1>) -> !fir.box<!fir.ptr<!fir.array<?xf32>>>
114116
! CHECK: fir.store %[[VAL_12]] to %[[VAL_10]] : !fir.ref<!fir.box<!fir.ptr<!fir.array<?xf32>>>>
115117
end subroutine

0 commit comments

Comments
 (0)