[Openmp-commits] [PATCH] D104382: [OpenMP][Offloading] Refined return value of `DeviceTy::getOrAllocTgtPtr`

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Jun 17 12:50:30 PDT 2021


tianshilei1992 added inline comments.


================
Comment at: openmp/libomptarget/src/device.cpp:275
          (HstPtrName) ? getNameFromMapping(HstPtrName).c_str() : "unknown");
-    HostDataToTargetMap.emplace(
-        HostDataToTargetTy((uintptr_t)HstPtrBase, (uintptr_t)HstPtrBegin,
-                           (uintptr_t)HstPtrBegin + Size, tp, HstPtrName));
-    rc = (void *)tp;
+    HostDataToTargetMap.emplace((uintptr_t)HstPtrBase, (uintptr_t)HstPtrBegin,
+                                (uintptr_t)HstPtrBegin + Size, Ptr, HstPtrName);
----------------
grokos wrote:
> I think `emplace` returns an iterator to the newly emplaced element. You can set `Entry` equal to the return value of this `emplace`, thus sparing a lookup a couple of lines below.
Thanks for the information. Yes, that will be better.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104382/new/

https://reviews.llvm.org/D104382



More information about the Openmp-commits mailing list