[llvm] [Offload] Implement `olShutDown` (PR #144055)
Ross Brunton via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 16 06:18:31 PDT 2025
================
@@ -94,15 +94,16 @@ struct AllocInfo {
};
using AllocInfoMapT = DenseMap<void *, AllocInfo>;
-AllocInfoMapT &allocInfoMap() {
- static AllocInfoMapT AllocInfoMap{};
- return AllocInfoMap;
-}
+static AllocInfoMapT *AllocInfoMap;
+AllocInfoMapT &allocInfoMap() { return *AllocInfoMap; }
using PlatformVecT = SmallVector<ol_platform_impl_t, 4>;
-PlatformVecT &Platforms() {
- static PlatformVecT Platforms;
- return Platforms;
+static PlatformVecT *PlatformList;
+PlatformVecT &Platforms() { return *PlatformList; }
+
+static std::atomic_int &GlobalRefCount() {
+ static std::atomic_int Ref{0};
+ return Ref;
}
----------------
RossBrunton wrote:
Mainly for consistency with the (old version) of `Platforms()` and `allocInfoMap()`. In theory it means that Ref isn't initialised until its first use, but in practice initialising an atomic_int probably isn't that expensive.
Does LLVM have a policy for how to handle global state like this?
https://github.com/llvm/llvm-project/pull/144055
More information about the llvm-commits
mailing list