[llvm-branch-commits] [flang] [llvm] [mlir] [OpenMP][MLIR] Modify OpenMP Dialect lowering to support attach mapping (PR #179023)

Pranav Bhandarkar via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Apr 2 13:48:21 PDT 2026


================
@@ -4587,10 +4601,16 @@ static void collectMapDataFromMapOperands(
   // Process MapOperands
   for (Value mapValue : mapVars) {
     auto mapOp = cast<omp::MapInfoOp>(mapValue.getDefiningOp());
-    Value offloadPtr =
-        mapOp.getVarPtrPtr() ? mapOp.getVarPtrPtr() : mapOp.getVarPtr();
+    bool isRefPtrOrPteeMapWithAttach =
+        checkRefPtrOrPteeMapWithAttach(mapOp.getMapType());
+    Value offloadPtr = (mapOp.getVarPtrPtr() && !isRefPtrOrPteeMapWithAttach)
+                           ? mapOp.getVarPtrPtr()
+                           : mapOp.getVarPtr();
     mapData.OriginalValue.push_back(moduleTranslation.lookupValue(offloadPtr));
-    mapData.Pointers.push_back(mapData.OriginalValue.back());
+    mapData.Pointers.push_back(
+        isRefPtrOrPteeMapWithAttach
+            ? moduleTranslation.lookupValue(mapOp.getVarPtrPtr())
----------------
bhandarkar-pranav wrote:

Is `mapOp.getVarPtrPtr()` guaranteed to be defined if `isRefPtrOrPteeMapWithAttach == true`. In line 4606-4608, it the code looks at `mapOp.getVarPtrPtr()` when `isRefPtrorPteeMapWithAttach == false`.

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


More information about the llvm-branch-commits mailing list