Index: llvm/include/llvm/Support/Allocator.h =================================================================== --- llvm/include/llvm/Support/Allocator.h +++ llvm/include/llvm/Support/Allocator.h @@ -137,10 +137,10 @@ /// object, which wraps malloc, to allocate memory, but it can be changed to /// use a custom allocator. template + size_t SizeThreshold = SlabSize, size_t SlabSizeGrowCount = 128> class BumpPtrAllocatorImpl - : public AllocatorBase< - BumpPtrAllocatorImpl> { + : public AllocatorBase> { public: static_assert(SizeThreshold <= SlabSize, "The SizeThreshold must be at most the SlabSize to ensure " @@ -391,10 +391,11 @@ static size_t computeSlabSize(unsigned SlabIdx) { // Scale the actual allocated slab size based on the number of slabs - // allocated. Every 128 slabs allocated, we double the allocated size to - // reduce allocation frequency, but saturate at multiplying the slab size by - // 2^30. - return SlabSize * ((size_t)1 << std::min(30, SlabIdx / 128)); + // allocated. Every SlabSizeGrowCount slabs allocated, we double the + // allocated size to reduce allocation frequency, but saturate at + // multiplying the slab size by 2^30. + return SlabSize * + ((size_t)1 << std::min(30, SlabIdx / SlabSizeGrowCount)); } /// Allocate a new slab and move the bump pointers over into the new