[PATCH] D90704: [OpenMP] target nested `use_device_ptr() if()` and is_device_ptr trigger asserts

Chi Chun Chen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 4 09:45:39 PST 2020


cchen added inline comments.


================
Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:2958-2970
+    auto PerDevice = OffloadEntriesTargetRegion.find(DeviceID);
+    if (PerDevice != OffloadEntriesTargetRegion.end()) {
+      auto PerFile = PerDevice->second.find(FileID);
+      if (PerFile != PerDevice->second.end()) {
+        auto PerParentName = PerFile->second.find(ParentName);
+        if (PerParentName != PerFile->second.end()) {
+          auto PerLine = PerParentName->second.find(LineNum);
----------------
cchen wrote:
> ABataev wrote:
> > ABataev wrote:
> > > Just:
> > > ```
> > > if (hasTargetRegionEntryInfo(DeviceID, FileID, ParentName, LineNum))
> > >   return;
> > > ```
> > Actually, even better to do something like this:
> > ```
> > if (Flags == OffloadEntriesInfoManagerTy::OMPTargetRegionEntryTargetRegion && hasTargetRegionEntryInfo(DeviceID, FileID, ParentName, LineNum))
> >   return;
> > assert(!hasTargetRegionEntryInfo(DeviceID, FileID, ParentName, LineNum) && "Target region entry already registered!");
> > ```
> I tried this code but found that `hasTargetRegionEntryInfo` is not doing what we want since we need the below code to return true in `hasTargetRegionEntryInfo`.
> ```
> if (PerLine->second.getAddress() || PerLine->second.getID()) {
>   return false;
> }
> ```
Do we want to create a new helper function like hasTargetRegionEntryInfo or something?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90704



More information about the cfe-commits mailing list