[flang-commits] [flang] [OpenMP]Update use_device_clause lowering (PR #101703)
Sergio Afonso via flang-commits
flang-commits at lists.llvm.org
Thu Aug 8 04:44:51 PDT 2024
================
@@ -200,43 +212,10 @@ bool ClauseProcessor::processMotionClauses(lower::StatementContext &stmtCtx,
? llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_TO
: llvm::omp::OpenMPOffloadMappingFlags::OMP_MAP_FROM;
- auto &objects = std::get<ObjectList>(clause.t);
- for (const omp::Object &object : objects) {
- llvm::SmallVector<mlir::Value> bounds;
- std::stringstream asFortran;
-
- lower::AddrAndBoundsInfo info =
- lower::gatherDataOperandAddrAndBounds<mlir::omp::MapBoundsOp,
- mlir::omp::MapBoundsType>(
- converter, firOpBuilder, semaCtx, stmtCtx, *object.sym(),
- object.ref(), clauseLocation, asFortran, bounds,
- treatIndexAsSection);
-
- auto origSymbol = converter.getSymbolAddress(*object.sym());
- mlir::Value symAddr = info.addr;
- if (origSymbol && fir::isTypeWithDescriptor(origSymbol.getType()))
- symAddr = origSymbol;
-
- // Explicit map captures are captured ByRef by default,
- // optimisation passes may alter this to ByCopy or other capture
- // types to optimise
- mlir::omp::MapInfoOp mapOp = createMapInfoOp(
- firOpBuilder, clauseLocation, symAddr,
- /*varPtrPtr=*/mlir::Value{}, asFortran.str(), bounds,
- /*members=*/{}, /*membersIndex=*/mlir::DenseIntElementsAttr{},
- static_cast<
- std::underlying_type_t<llvm::omp::OpenMPOffloadMappingFlags>>(
- mapTypeBits),
- mlir::omp::VariableCaptureKind::ByRef, symAddr.getType());
-
- if (object.sym()->owner().IsDerivedType()) {
- addChildIndexAndMapToParent(object, parentMemberIndices, mapOp,
- semaCtx);
- } else {
- result.mapVars.push_back(mapOp);
- mapSymbols.push_back(object.sym());
- }
- }
+ processMapObjects(stmtCtx, clauseLocation,
+ std::get<ObjectList>(clause.t), mapTypeBits,
+ parentMemberIndices, result.mapVars, &mapSymbols,
+ nullptr, nullptr);
----------------
skatrak wrote:
Nit: These two arguments are already default-valued to `nullptr`, so you can omit them from this call.
https://github.com/llvm/llvm-project/pull/101703
More information about the flang-commits
mailing list