[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
================
@@ -845,113 +891,129 @@ genBodyOfTargetOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
if (sym->owner().IsDerivedType())
continue;
fir::ExtendedValue extVal = converter.getSymbolExtendedValue(*sym);
- extVal.match(
- [&](const fir::BoxValue &v) {
- converter.bindSymbol(*sym,
- fir::BoxValue(arg, cloneBounds(v.getLBounds()),
- v.getExplicitParameters(),
- v.getExplicitExtents()));
- },
- [&](const fir::MutableBoxValue &v) {
- converter.bindSymbol(
- *sym, fir::MutableBoxValue(arg, cloneBounds(v.getLBounds()),
- v.getMutableProperties()));
- },
- [&](const fir::ArrayBoxValue &v) {
- converter.bindSymbol(
- *sym, fir::ArrayBoxValue(arg, cloneBounds(v.getExtents()),
- cloneBounds(v.getLBounds()),
- v.getSourceBox()));
- },
- [&](const fir::CharArrayBoxValue &v) {
- converter.bindSymbol(
- *sym, fir::CharArrayBoxValue(arg, cloneBound(v.getLen()),
- cloneBounds(v.getExtents()),
- cloneBounds(v.getLBounds())));
- },
- [&](const fir::CharBoxValue &v) {
- converter.bindSymbol(*sym,
- fir::CharBoxValue(arg, cloneBound(v.getLen())));
- },
- [&](const fir::UnboxedValue &v) { converter.bindSymbol(*sym, arg); },
- [&](const auto &) {
- TODO(converter.getCurrentLocation(),
- "target map clause operand unsupported type");
- });
- }
-
- for (auto [argIndex, argSymbol] :
- llvm::enumerate(dsp.getAllSymbolsToPrivatize())) {
- argIndex = mapSyms.size() + argIndex;
-
- const mlir::BlockArgument &arg = region.getArgument(argIndex);
- converter.bindSymbol(*argSymbol,
- hlfir::translateToExtendedValue(
- currentLocation, firOpBuilder, hlfir::Entity{arg},
- /*contiguousHint=*/
- evaluate::IsSimplyContiguous(
- *argSymbol, converter.getFoldingContext()))
- .first);
+ auto refType = mlir::dyn_cast<fir::ReferenceType>(arg.getType());
+ if (!isTargetOp && refType &&
+ fir::isa_builtin_cptr_type(refType.getElementType())) {
+ converter.bindSymbol(*argSymbol, arg);
----------------
skatrak wrote:
If this is only needed for `target data` and not `target`, I think we need a comment here to explain why. Otherwise, we should decide whether we are supposed to do this in both cases or in none of them, since it looks to me like something that may have slipped through the cracks due to having this code duplicated between `genBodyOfTargetOp` and `genBodyOfTargetDataOp`. Perhaps @agozillon can comment on that.
https://github.com/llvm/llvm-project/pull/101703
More information about the flang-commits
mailing list