[Clang][OpenMP] Fixed an issue that clang crashed when compiling OpenMP program in device only mode without host IR
D94745 rewrites the deviceRTLs using OpenMP and compiles it by directly
calling the device compilation. clang crashes because entry in
OffloadEntriesDeviceGlobalVar is unintialized. Current design supposes the
device compilation can only be invoked after host compilation with the host IR
such that clang can initialize OffloadEntriesDeviceGlobalVar from host IR.
This avoids us using device compilation directly, especially when we only have
code wrapped into declare target which are all device code. The same issue
also exists for OffloadEntriesInfoManager.
In this patch, we simply initialized an entry if it is not in the maps. Not sure
we need an option to tell the device compiler that it is invoked standalone.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D94871