[llvm] [SystemZ][z/OS] use LLVM_THREAD_LOCAL instead of thread_local (PR #214039)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 4 12:01:57 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-support

Author: Abhina Sree (abhina-sree)

<details>
<summary>Changes</summary>

This patch is to fix the following error on z/OS

```
llvm/include/llvm/Support/PerThreadBumpPtrAllocator.h:75:12: error: thread-local storage is not supported for the current target
   75 |     static thread_local std::vector<AllocatorTy *> Cache;
      |            ^
```

---
Full diff: https://github.com/llvm/llvm-project/pull/214039.diff


1 Files Affected:

- (modified) llvm/include/llvm/Support/PerThreadBumpPtrAllocator.h (+1-1) 


``````````diff
diff --git a/llvm/include/llvm/Support/PerThreadBumpPtrAllocator.h b/llvm/include/llvm/Support/PerThreadBumpPtrAllocator.h
index 846c92933c47e..ef304c6b065b7 100644
--- a/llvm/include/llvm/Support/PerThreadBumpPtrAllocator.h
+++ b/llvm/include/llvm/Support/PerThreadBumpPtrAllocator.h
@@ -72,7 +72,7 @@ class PerThreadAllocator
     // map lookup and shared_ptr bookkeeping per allocation. Instances here are
     // few and short-lived, so we prefer the O(1) vector index and accept that a
     // thread's Cache only grows with the number of instances created.
-    static thread_local std::vector<AllocatorTy *> Cache;
+    static LLVM_THREAD_LOCAL std::vector<AllocatorTy *> Cache;
     if (LLVM_UNLIKELY(Cache.size() <= Id))
       Cache.resize(Id + 1);
     AllocatorTy *&A = Cache[Id];

``````````

</details>


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


More information about the llvm-commits mailing list