[PATCH] D94871: [Clang][OpenMP] Fixed an issue that clang crashed when compiling OpenMP program in device only mode without host IR

Shilei Tian via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 18 18:28:56 PST 2021


tianshilei1992 marked 3 inline comments as done.
tianshilei1992 added inline comments.


================
Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:2944-2947
+    // This could happen if the device compilation is invoked standalone.
+    if (!hasTargetRegionEntryInfo(DeviceID, FileID, ParentName, LineNum))
+      initializeTargetRegionEntryInfo(DeviceID, FileID, ParentName, LineNum,
+                                      OffloadingEntriesNum);
----------------
ABataev wrote:
> jdoerfert wrote:
> > ABataev wrote:
> > > I would add a chack that to auxiliary device was specified. And if it was specified, it means this is not device-only mode and still need to emit an error.
> > No it doesn't. There is nothing wrong with https://godbolt.org/z/T1h9b5, and as I said before, I can build the situation in various other ways as well, some of which will be outside of the users control. A global can exist in the host/device code only.
> I'm not saying that this is wrong. This code was used to check that the compiler works correctly and it just allows developer to understand that there is a problem with the compiler if it misses something and there is a difference between host and device codegens. If we don't want to emit an error here, still would be good to have something like an assert to be sure that the host/device codegens are synced.
That check still doesn't work for the test case provided by @jdoerfert because host IR doesn't contain that global in the offload info.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94871



More information about the cfe-commits mailing list