In many situations the current version of getUniqueModuleId returns no hash. This causes problems for ThinLTOBitcodeWriter pass, and it will fall back to generating a regular LTO module in these cases. Since it's preferable to generate a ThinLTO module for performance reasons, this patch allows getUniqueModuleId to use more types of GlobalValues when generating the ModuleId hash. This mix has been fairly reliable for us.
This change is part of the Unified LTO RFC: https://discourse.llvm.org/t/rfc-a-unified-lto-bitcode-frontend/61774