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

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


https://github.com/abhina-sree created https://github.com/llvm/llvm-project/pull/214039

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;
      |            ^
```

>From adf4cf5c9cd5f5af5e33692b46fa1ada2d138e1b Mon Sep 17 00:00:00 2001
From: Abhina Sreeskantharajan <Abhina.Sreeskantharajan at ibm.com>
Date: Tue, 4 Aug 2026 14:59:33 -0400
Subject: [PATCH] use LLVM_THREAD_LOCAL instead of thread_local

---
 llvm/include/llvm/Support/PerThreadBumpPtrAllocator.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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];



More information about the llvm-commits mailing list