[flang-commits] [flang] [Flang][MLIR] - Handle the mapping of subroutine arguments when they are subsequently used inside the region of an `omp.target` Op (PR #134967)

via flang-commits flang-commits at lists.llvm.org
Mon May 12 01:39:16 PDT 2025


================
@@ -217,59 +217,36 @@ static void bindEntryBlockArgs(lower::AbstractConverter &converter,
   assert(args.isValid() && "invalid args");
   fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
 
-  auto bindSingleMapLike = [&converter,
-                            &firOpBuilder](const semantics::Symbol &sym,
-                                           const mlir::BlockArgument &arg) {
-    // Clones the `bounds` placing them inside the entry block and returns
-    // them.
-    auto cloneBound = [&](mlir::Value bound) {
-      if (mlir::isMemoryEffectFree(bound.getDefiningOp())) {
-        mlir::Operation *clonedOp = firOpBuilder.clone(*bound.getDefiningOp());
-        return clonedOp->getResult(0);
-      }
-      TODO(converter.getCurrentLocation(),
-           "target map-like clause operand unsupported bound type");
-    };
-
-    auto cloneBounds = [cloneBound](llvm::ArrayRef<mlir::Value> bounds) {
-      llvm::SmallVector<mlir::Value> clonedBounds;
-      llvm::transform(bounds, std::back_inserter(clonedBounds),
-                      [&](mlir::Value bound) { return cloneBound(bound); });
-      return clonedBounds;
-    };
-
----------------
jeanPerier wrote:

It matters that they are cloned somehow since the region is isolated from above, but I think you may be handling it in the code below on line 1347 that is cloning all the values that do not belong to the region. So, explicit cloning is likely not needed anymore.

```
  mlir::getUsedValuesDefinedAbove(region, valuesDefinedAbove);
  while (!valuesDefinedAbove.empty()) {
```

https://github.com/llvm/llvm-project/pull/134967


More information about the flang-commits mailing list