summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Allocator.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-04-13 16:38:06 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-04-13 16:38:06 +0000
commit55cfaa37dee542c48e9e57802e78b461dcda9239 (patch)
treefcac1fa089a36bd77c28c2d99f1cac788402851b /llvm/lib/Support/Allocator.cpp
parent38ae6ab6bc14dd478045d0ac059ae3ebb5505b3b (diff)
downloadbcm5719-llvm-55cfaa37dee542c48e9e57802e78b461dcda9239.tar.gz
bcm5719-llvm-55cfaa37dee542c48e9e57802e78b461dcda9239.zip
BumpPtrAllocator::Reset() doesn't need to allocate anything. (Thanks, Jakob)
llvm-svn: 101138
Diffstat (limited to 'llvm/lib/Support/Allocator.cpp')
-rw-r--r--llvm/lib/Support/Allocator.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/Allocator.cpp b/llvm/lib/Support/Allocator.cpp
index ef40e47d985..90df262336c 100644
--- a/llvm/lib/Support/Allocator.cpp
+++ b/llvm/lib/Support/Allocator.cpp
@@ -70,8 +70,8 @@ void BumpPtrAllocator::DeallocateSlabs(MemSlab *Slab) {
/// Reset - Deallocate all but the current slab and reset the current pointer
/// to the beginning of it, freeing all memory allocated so far.
void BumpPtrAllocator::Reset() {
- if (!CurSlab) // Start a new slab if we didn't allocate one already.
- StartNewSlab();
+ if (!CurSlab)
+ return;
DeallocateSlabs(CurSlab->NextPtr);
CurSlab->NextPtr = 0;
CurPtr = (char*)(CurSlab + 1);
OpenPOWER on IntegriCloud