Skip to content
Open
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
12 changes: 10 additions & 2 deletions flang/include/flang/Lower/DirectivesCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -512,11 +512,19 @@ fir::factory::AddrAndBoundsInfo gatherDataOperandAddrAndBounds(
}
bool dataExvIsAssumedSize =
Fortran::semantics::IsAssumedSizeArray(symRef->get().GetUltimate());
if (genDefaultBounds &&
mlir::isa<fir::SequenceType>(fir::unwrapRefType(info.addr.getType())))
if (genDefaultBounds && mlir::isa<fir::SequenceType>(
fir::unwrapRefType(info.addr.getType()))) {
bounds = fir::factory::genBaseBoundsOps<BoundsOp, BoundsType>(
builder, operandLocation, dataExv, dataExvIsAssumedSize,
strideIncludeLowerExtent);
}
if (genDefaultBounds && fir::characterWithDynamicLen(
fir::unwrapRefType(info.addr.getType())) ||
mlir::isa<fir::BoxCharType>(
fir::unwrapRefType(info.addr.getType()))) {
bounds = {fir::factory::genBoundsOpFromBoxChar<BoundsOp, BoundsType>(
builder, operandLocation, dataExv, info)};
}
asFortran << symRef->get().name().ToString();
} else { // Unsupported
llvm::report_fatal_error("Unsupported type of OpenACC operand");
Expand Down
32 changes: 0 additions & 32 deletions flang/lib/Optimizer/OpenMP/MapInfoFinalization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -987,38 +987,6 @@ class MapInfoFinalizationPass
localBoxAllocas.clear();
deferrableDesc.clear();

// First, walk `omp.map.info` ops to see if any of them have varPtrs
// with an underlying type of fir.char<k, ?>, i.e a character
// with dynamic length. If so, check if they need bounds added.
func->walk([&](mlir::omp::MapInfoOp op) {
if (!op.getBounds().empty())
return;

mlir::Value varPtr = op.getVarPtr();
mlir::Type underlyingVarType = fir::unwrapRefType(varPtr.getType());

if (!fir::characterWithDynamicLen(underlyingVarType))
return;

fir::factory::AddrAndBoundsInfo info =
fir::factory::getDataOperandBaseAddr(
builder, varPtr, /*isOptional=*/false, varPtr.getLoc());

fir::ExtendedValue extendedValue =
hlfir::translateToExtendedValue(varPtr.getLoc(), builder,
hlfir::Entity{info.addr},
/*continguousHint=*/true)
.first;
builder.setInsertionPoint(op);
llvm::SmallVector<mlir::Value> boundsOps =
fir::factory::genImplicitBoundsOps<mlir::omp::MapBoundsOp,
mlir::omp::MapBoundsType>(
builder, info, extendedValue,
/*dataExvIsAssumedSize=*/false, varPtr.getLoc());

op.getBoundsMutable().append(boundsOps);
});

// Next, walk `omp.map.info` ops to see if any record members should be
// implicitly mapped.
func->walk([&](mlir::omp::MapInfoOp op) {
Expand Down