[flang-commits] [flang] [flang][MLIR][OpenMP] Extend delayed privatization for scalar allocatables (PR #84740)

Kareem Ergawy via flang-commits flang-commits at lists.llvm.org
Tue Mar 12 01:03:42 PDT 2024


================
@@ -535,6 +535,17 @@ class ExtendedValue : public details::matcher<ExtendedValue> {
 
   const VT &matchee() const { return box; }
 
+  /// Clone an ExtendedValue to a new instance changing the base address.
+  ///
+  /// TODO So far, this is only a shallow clone; only the base address is
+  /// replaced. This will probably be extended to implement deep cloning to
+  /// support scenarios such as delayed privatization for ArrayBoxValue's.
+  ExtendedValue clone(mlir::Value newBase) const {
+    return match(
+        [&](const UnboxedValue &box) -> ExtendedValue { return newBase; },
+        [&](const auto &box) -> ExtendedValue { return box.clone(newBase); });
+  }
----------------
ergawy wrote:

It can indeed. I just overlooked it. Removed `clone` and used `substBase` instead.

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


More information about the flang-commits mailing list