[llvm] [Offload] Introduce ATTACH map-type support for pointer attachment. (PR #149036)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 8 06:09:37 PDT 2025


================
@@ -821,19 +821,22 @@ int processAttachEntries(DeviceTy &Device, AttachInfoTy &AttachInfo,
       return TPR;
     };
 
-    // Get device version of the pointer (e.g., &p)
+    // Get device version of the pointee (e.g., &p[10]) first, as we can
+    // release its TPR after extracting the pointer value.
+    void *TgtPteeBegin;
+    if (auto PteeTPROpt = LookupTargetPointer(HstPteeBegin, 0, "pointee"))
+      TgtPteeBegin = PteeTPROpt->TargetPointer;
+    else
+      continue;
----------------
arsenm wrote:

You can also just brace the scope around the condition, I was trying to avoid the uninitialized TgtPteeBegin at declaration 

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


More information about the llvm-commits mailing list