Make the heuristic for shrinking DenseMap smarter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40114 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2007-07-20 18:56:46 +00:00
parent edbef38067
commit 398b40671b

View File

@ -15,6 +15,7 @@
#define LLVM_ADT_DENSEMAP_H
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/MathExtras.h"
#include <cassert>
#include <utility>
@ -300,8 +301,9 @@ private:
unsigned OldNumBuckets = NumBuckets;
BucketT *OldBuckets = Buckets;
// Halve the number of buckets.
NumBuckets >>= 1;
// Reduce the number of buckets.
NumBuckets = NumEntries > 32 ? 1 << (Log2_32_Ceil(NumEntries) + 1)
: 64;
NumTombstones = 0;
Buckets = (BucketT*)new char[sizeof(BucketT)*NumBuckets];