[flang-commits] [openmp] [flang] [mlir] [Flang][OpenMP] Initial mapping of Fortran pointers and allocatables for target devices (PR #71766)
via flang-commits
flang-commits at lists.llvm.org
Tue Nov 28 04:32:48 PST 2023
================
@@ -1791,31 +1785,50 @@ bool ClauseProcessor::processMap(
for (const Fortran::parser::OmpObject &ompObject :
std::get<Fortran::parser::OmpObjectList>(mapClause->v.t).v) {
+ auto origSymbol =
+ converter.getSymbolAddress(*getOmpObjectSymbol(ompObject));
llvm::SmallVector<mlir::Value> bounds;
std::stringstream asFortran;
mlir::Value baseAddr = Fortran::lower::gatherDataOperandAddrAndBounds<
Fortran::parser::OmpObject, mlir::omp::DataBoundsType,
mlir::omp::DataBoundsOp>(
converter, firOpBuilder, semanticsContext, stmtCtx, ompObject,
clauseLocation, asFortran, bounds, treatIndexAsSection);
-
- // Explicit map captures are captured ByRef by default,
- // optimisation passes may alter this to ByCopy or other capture
- // types to optimise
- mlir::Value mapOp = createMapInfoOp(
- firOpBuilder, clauseLocation, baseAddr, asFortran, bounds,
- static_cast<
- std::underlying_type_t<llvm::omp::OpenMPOffloadMappingFlags>>(
- mapTypeBits),
- mlir::omp::VariableCaptureKind::ByRef, baseAddr.getType());
-
- mapOperands.push_back(mapOp);
- if (mapSymTypes)
- mapSymTypes->push_back(baseAddr.getType());
- if (mapSymLocs)
- mapSymLocs->push_back(baseAddr.getLoc());
- if (mapSymbols)
- mapSymbols->push_back(getOmpObjectSymbol(ompObject));
+ if (fir::isPointerType(origSymbol.getType()) ||
+ fir::isAllocatableType(origSymbol.getType()) ||
+ fir::isAssumedShape(origSymbol.getType())) {
----------------
agozillon wrote:
Ah I forgot to add those when I added this tweak to cover assumed-shape! Thank you for the reminder. Assumed-size also seems to work currently so I'll add those if they continue to work as well after the base_addr_addr change.
https://github.com/llvm/llvm-project/pull/71766
More information about the flang-commits
mailing list