[flang-commits] [flang] [flang][cuda] Preserve array lower bounds in implicit device-to-host transfer (PR #227824)

via flang-commits flang-commits at lists.llvm.org
Thu Oct 1 06:11:08 PDT 2026


================
@@ -43,6 +43,35 @@ fir::ExtendedValue fir::substBase(const fir::ExtendedValue &exv,
       [=](const auto &x) { return fir::ExtendedValue(x.clone(base)); });
 }
 
+fir::ExtendedValue
+fir::updateRuntimeLBounds(const fir::ExtendedValue &exv,
+                           llvm::ArrayRef<mlir::Value> lbounds) {
+  if (lbounds.empty())
+    return exv;
----------------
jeanPerier wrote:

That is making the assumption that exv itself does not have non default lower bounds that one would want to reset to default lower bounds.

You can add a "mayHaveNonDefaultLowerBounds" helper to fir::ExtendedValue class in order to turn that into `lbounds.empty() && !exv.mayHaveNonDefaultLowerBounds()`

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


More information about the flang-commits mailing list