[llvm] [Allocator] Keep bump pointer at a minimum alignment (PR #203718)

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 14 03:55:34 PDT 2026


================
@@ -388,7 +400,11 @@ using BumpPtrAllocator = BumpPtrAllocatorImpl<>;
 /// This allows calling the destructor in DestroyAll() and when the allocator is
 /// destroyed.
 template <typename T> class SpecificBumpPtrAllocator {
-  BumpPtrAllocator Allocator;
+  // DestroyAll() walks objects at a fixed sizeof(T) stride, so it needs tight
+  // packing: MinAlign=1 disables the default size rounding.
+  using BumpPtrAllocatorTy =
+      BumpPtrAllocatorImpl<MallocAllocator, 4096, 4096, 128, /*MinAlign=*/1>;
----------------
aengelke wrote:

why not alignof(T)? There shouldn't be a difference?

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


More information about the llvm-commits mailing list