Revert "Fix allocations of SmallVector and SmallPtrSet so they are more prone to"
[oota-llvm.git] / include / llvm / ADT / SmallVector.h
index 6ea8de511da9517cb9f0899260040cfb0981e6c0..9167f872185d94bc4dd54bee7c84616f2a2d98ba 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "llvm/Support/AlignOf.h"
 #include "llvm/Support/Compiler.h"
-#include "llvm/Support/MathExtras.h"
 #include "llvm/Support/type_traits.h"
 #include <algorithm>
 #include <cassert>
@@ -268,8 +267,7 @@ template <typename T, bool isPodLike>
 void SmallVectorTemplateBase<T, isPodLike>::grow(size_t MinSize) {
   size_t CurCapacity = this->capacity();
   size_t CurSize = this->size();
- // Always grow, even from zero.  
-  size_t NewCapacity = NextPowerOf2(2*CurCapacity+(CurCapacity==0));
+  size_t NewCapacity = 2*CurCapacity + 1; // Always grow, even from zero.
   if (NewCapacity < MinSize)
     NewCapacity = MinSize;
   T *NewElts = static_cast<T*>(malloc(NewCapacity*sizeof(T)));