[PATCH] BumpPtrAllocator: remove redundant no-slabs-allocated-yet check

Hans Wennborg hans at chromium.org
Sun Aug 17 11:40:47 PDT 2014


Closed by commit rL215841 (authored by @hans).

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D4943

Files:
  llvm/trunk/include/llvm/Support/Allocator.h
  llvm/trunk/unittests/Support/AllocatorTest.cpp

Index: llvm/trunk/unittests/Support/AllocatorTest.cpp
===================================================================
--- llvm/trunk/unittests/Support/AllocatorTest.cpp
+++ llvm/trunk/unittests/Support/AllocatorTest.cpp
@@ -112,7 +112,7 @@
   BumpPtrAllocator Alloc;
 
   Alloc.Allocate(8000, 0);
-  EXPECT_EQ(2U, Alloc.GetNumSlabs());
+  EXPECT_EQ(1U, Alloc.GetNumSlabs());
 }
 
 // Mock slab allocator that returns slabs aligned on 4096 bytes.  There is no
Index: llvm/trunk/include/llvm/Support/Allocator.h
===================================================================
--- llvm/trunk/include/llvm/Support/Allocator.h
+++ llvm/trunk/include/llvm/Support/Allocator.h
@@ -201,9 +201,6 @@
 
   /// \brief Allocate space at the specified alignment.
   void *Allocate(size_t Size, size_t Alignment) {
-    if (!CurPtr) // Start a new slab if we haven't allocated one already.
-      StartNewSlab();
-
     // Keep track of how many bytes we've allocated.
     BytesAllocated += Size;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4943.12591.patch
Type: text/x-patch
Size: 993 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140817/7808a5b2/attachment.bin>


More information about the llvm-commits mailing list