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

Kiran Chandramohan via flang-commits flang-commits at lists.llvm.org
Mon Mar 11 05:30:20 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); });
+  }
----------------
kiranchandramohan wrote:

Can substBase be used here? `lib/Optimizer/Builder/BoxValue.cpp:fir::ExtendedValue fir::substBase`

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


More information about the flang-commits mailing list