[llvm] [Offload] Implement `olShutDown` (PR #144055)

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 16 05:49:14 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;
 }
----------------
jhuber6 wrote:

What's the benefit of this over a global variable?

https://github.com/llvm/llvm-project/pull/144055


More information about the llvm-commits mailing list