summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/SmallVector.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-09-02 21:55:03 +0000
committerJohn McCall <rjmccall@apple.com>2010-09-02 21:55:03 +0000
commit7f55c258c638431e6dbe3e8fc53a40d409192c4b (patch)
treef0ea39cadee765701f1c98d0beeff2d6b7869966 /llvm/lib/Support/SmallVector.cpp
parent814a69c330371d5fcad28715b939609c557e3fdb (diff)
downloadbcm5719-llvm-7f55c258c638431e6dbe3e8fc53a40d409192c4b.tar.gz
bcm5719-llvm-7f55c258c638431e6dbe3e8fc53a40d409192c4b.zip
After some discussion with djg, teach SmallVector to grow from a zero
capacity and remove the workaround in SmallVector<T,0>. There are some theoretical benefits to a N->2N+1 growth policy anyway. llvm-svn: 112870
Diffstat (limited to 'llvm/lib/Support/SmallVector.cpp')
-rw-r--r--llvm/lib/Support/SmallVector.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/SmallVector.cpp b/llvm/lib/Support/SmallVector.cpp
index 2e17af86415..a89f1495763 100644
--- a/llvm/lib/Support/SmallVector.cpp
+++ b/llvm/lib/Support/SmallVector.cpp
@@ -18,7 +18,7 @@ using namespace llvm;
/// on POD-like datatypes and is out of line to reduce code duplication.
void SmallVectorBase::grow_pod(size_t MinSizeInBytes, size_t TSize) {
size_t CurSizeBytes = size_in_bytes();
- size_t NewCapacityInBytes = 2 * capacity_in_bytes();
+ size_t NewCapacityInBytes = 2 * capacity_in_bytes() + TSize; // Always grow.
if (NewCapacityInBytes < MinSizeInBytes)
NewCapacityInBytes = MinSizeInBytes;
OpenPOWER on IntegriCloud