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

Johannes Doerfert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 18 14:17:06 PST 2021


jdoerfert accepted this revision.
jdoerfert added a comment.
This revision is now accepted and ready to land.

LGTM, one nit in the test below.



================
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:
> 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.


================
Comment at: clang/test/OpenMP/declare_target_device_only_compilation.cpp:13
+// CHECK: !omp_offload.info = !{!0}
+// CHECK: !0 = !{i32 1, !"[[G]]", i32 0, i32 0}
----------------
Run this as regular target offloading as well. no `-fopenmp-is-device` necessary, at least not in https://godbolt.org/z/T1h9b5.


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