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

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 4 07:55:44 PST 2020


ABataev 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);
----------------
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!");
```


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