aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Support/Allocator.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2009-07-25 21:26:02 +0000
committerReid Kleckner <reid@kleckner.net>2009-07-25 21:26:02 +0000
commit7d509134dcec17f6094032196b21af5c67943f0f (patch)
tree956480aceff06b421f0ab357919fd759843b3712 /lib/Support/Allocator.cpp
parentb4fc419d83bc4afc8ce5a204dd226d5ae58f5896 (diff)
downloadexternal_llvm-7d509134dcec17f6094032196b21af5c67943f0f.zip
external_llvm-7d509134dcec17f6094032196b21af5c67943f0f.tar.gz
external_llvm-7d509134dcec17f6094032196b21af5c67943f0f.tar.bz2
Added a test and fixed a bug in BumpPtrAllocator relating to large alignment
values. Hopefully this fixes PR4622. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77088 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Allocator.cpp')
-rw-r--r--lib/Support/Allocator.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Support/Allocator.cpp b/lib/Support/Allocator.cpp
index 230c421..36da443 100644
--- a/lib/Support/Allocator.cpp
+++ b/lib/Support/Allocator.cpp
@@ -95,8 +95,8 @@ void *BumpPtrAllocator::Allocate(size_t Size, size_t Alignment) {
}
// If Size is really big, allocate a separate slab for it.
- if (Size > SizeThreshold) {
- size_t PaddedSize = Size + sizeof(MemSlab) + Alignment - 1;
+ size_t PaddedSize = Size + sizeof(MemSlab) + Alignment - 1;
+ if (PaddedSize > SizeThreshold) {
MemSlab *NewSlab = Allocator.Allocate(PaddedSize);
// Put the new slab after the current slab, since we are not allocating