Make the heuristic for shrinking DenseMap smarter.

llvm-svn: 40114
This commit is contained in:
Owen Anderson 2007-07-20 18:56:46 +00:00
parent 9802144709
commit 74f833bce1
1 changed files with 4 additions and 2 deletions

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];