[flang-commits] [flang] [flang][OpenMP] Recompute descriptor across workdistribute target fission (PR #225607)

via flang-commits flang-commits at lists.llvm.org
Tue Oct 6 01:52:30 PDT 2026


================
@@ -882,6 +882,12 @@ static bool usedOutsideSplit(Value v, Operation *split) {
 
 /// isRecomputableAfterFission checks if an operation can be recomputed
 static bool isRecomputableAfterFission(Operation *op, Operation *splitBefore) {
+  // A descriptor load must be recomputed from the mapped descriptor in each
+  // split target. Caching the box by value captures a host base_addr that the
+  // flat to/from copy cannot re-attach to the device data.
+  if (auto load = dyn_cast<fir::LoadOp>(op))
+    if (isa<fir::BaseBoxType>(load.getType()))
+      return true;
----------------
skc7 wrote:

Fixed in latest commit. `box` loads are recomputed only when they load directly from a mapped target block argument that is never written in the region. Added tests for the same.

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


More information about the flang-commits mailing list