[flang-commits] [flang] [flang][cuda] Enable data transfer for descriptors (PR #92804)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Mon May 20 14:41:46 PDT 2024


================
@@ -3717,8 +3717,17 @@ class FirConverter : public Fortran::lower::AbstractConverter {
                            hlfir::Entity &lhs, hlfir::Entity &rhs) {
     bool lhsIsDevice = Fortran::evaluate::HasCUDAAttrs(assign.lhs);
     bool rhsIsDevice = Fortran::evaluate::HasCUDAAttrs(assign.rhs);
-    if (rhs.isBoxAddressOrValue() || lhs.isBoxAddressOrValue())
-      TODO(loc, "CUDA data transfler with descriptors");
+
+    auto getRefIfLoaded = [](mlir::Value val) -> mlir::Value {
+      if (mlir::isa_and_nonnull<fir::LoadOp>(val.getDefiningOp())) {
----------------
vzakhari wrote:

nit: you could just use `dyn_cast_or_null` and get rid of `loadOp` declaration below.
```suggestion
      if (auto loadOp = mlir::dyn_cast_or_null<fir::LoadOp>(val.getDefiningOp())) {
```

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


More information about the flang-commits mailing list