[PATCH] D129206: [ADT] Use Empty Base Optimization for Allocators

Nathan James via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 6 07:43:32 PDT 2022


njames93 created this revision.
njames93 added reviewers: dblaikie, chandlerc.
Herald added a project: All.
njames93 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

In D94439 <https://reviews.llvm.org/D94439>, BumpPtrAllocator changed its implementation to use an empty base optimization for the underlying allocator.
This patch builds on that by extending its functionality to more classes as well as enabling the underlying allocator to be a reference type, something not currently possible as you can't derive from a reference.

The main place this sees use is in StringMaps which often use the default MallocAllocator, yet have to pay the size of a pointer for no reason.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129206

Files:
  llvm/include/llvm/ADT/ScopedHashTable.h
  llvm/include/llvm/ADT/StringMap.h
  llvm/include/llvm/Support/Allocator.h
  llvm/include/llvm/Support/AllocatorBase.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129206.442570.patch
Type: text/x-patch
Size: 10495 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220706/a21de3eb/attachment.bin>


More information about the llvm-commits mailing list