Skip to content

Commit

Permalink
Revert "[ADT][ConcurrentHashTable] Change thread_local to LLVM_THREAD…
Browse files Browse the repository at this point in the history
…_LOCAL inside unit test."

This reverts commit 9ef7013.
  • Loading branch information
avl-llvm committed Apr 6, 2023
1 parent 2c57868 commit b24b179
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions llvm/unittests/ADT/ConcurrentHashtableTest.cpp
Expand Up @@ -36,27 +36,19 @@ class String {
std::array<char, 0x20> ExtraData;
};

static LLVM_THREAD_LOCAL BumpPtrAllocator *ThreadLocalAllocator = nullptr;
static thread_local BumpPtrAllocator ThreadLocalAllocator;
class PerThreadAllocator : public AllocatorBase<PerThreadAllocator> {
public:
inline LLVM_ATTRIBUTE_RETURNS_NONNULL void *Allocate(size_t Size,
size_t Alignment) {
return getAllocatorPtr()->Allocate(Size, Align(Alignment));
return ThreadLocalAllocator.Allocate(Size, Align(Alignment));
}
inline size_t getBytesAllocated() {
return getAllocatorPtr()->getBytesAllocated();
inline size_t getBytesAllocated() const {
return ThreadLocalAllocator.getBytesAllocated();
}

// Pull in base class overloads.
using AllocatorBase<PerThreadAllocator>::Allocate;

protected:
BumpPtrAllocator *getAllocatorPtr() {
if (ThreadLocalAllocator == nullptr)
ThreadLocalAllocator = new BumpPtrAllocator();

return ThreadLocalAllocator;
}
} Allocator;

TEST(ConcurrentHashTableTest, AddStringEntries) {
Expand Down

0 comments on commit b24b179

Please sign in to comment.