[OpenMP] Only generate runtime flags with host input
authorJoseph Huber <jhuber6@vols.utk.edu>
Thu, 27 Jan 2022 20:50:18 +0000 (15:50 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Thu, 27 Jan 2022 23:43:41 +0000 (18:43 -0500)
commit2945f11c605b059446ac997f62458a6c489e46f7
tree55995ecf6a9d398ead6dc3f14c8782e40ebd40fb
parent1e3a02162db20264e9615b1346420c8d199cb347
[OpenMP] Only generate runtime flags with host input

This patch changes the code generation of runtime flags to only occur if
a host bitcode file was passed in. This is a cheap way to determine if
we are compiling the OpenMP device runtime itself or user code. This is
needed because the global flags we generate for the device runtime e.g.
__omp_rtl_debug_kind were being generated with default values when we
compiled the runtime library. This would then invalidate the ones we
want to be able to add in when the user defines it.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D118399
clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
clang/test/OpenMP/target_globals_codegen.cpp