aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2007-07-20 18:56:46 +0000
committerOwen Anderson <resistor@mac.com>2007-07-20 18:56:46 +0000
commit0535c3eb2c60b14dad733832e68ca3d4c9320b5e (patch)
treef7a824ef4de5893fc7776276d80e7d7e852eadfd
parentf8cde5746bc28c0d50e152d95d1b9883347298f2 (diff)
downloadexternal_llvm-0535c3eb2c60b14dad733832e68ca3d4c9320b5e.zip
external_llvm-0535c3eb2c60b14dad733832e68ca3d4c9320b5e.tar.gz
external_llvm-0535c3eb2c60b14dad733832e68ca3d4c9320b5e.tar.bz2
Make the heuristic for shrinking DenseMap smarter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40114 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/ADT/DenseMap.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h
index 082fc35..78caba5 100644
--- a/include/llvm/ADT/DenseMap.h
+++ b/include/llvm/ADT/DenseMap.h
@@ -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];