[llvm-commits] [llvm] r40114 - /llvm/trunk/include/llvm/ADT/DenseMap.h
Owen Anderson
resistor at mac.com
Fri Jul 20 11:56:46 PDT 2007
Author: resistor
Date: Fri Jul 20 13:56:46 2007
New Revision: 40114
URL: http://llvm.org/viewvc/llvm-project?rev=40114&view=rev
Log:
Make the heuristic for shrinking DenseMap smarter.
Modified:
llvm/trunk/include/llvm/ADT/DenseMap.h
Modified: llvm/trunk/include/llvm/ADT/DenseMap.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DenseMap.h?rev=40114&r1=40113&r2=40114&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/DenseMap.h (original)
+++ llvm/trunk/include/llvm/ADT/DenseMap.h Fri Jul 20 13:56:46 2007
@@ -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 @@
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];
More information about the llvm-commits
mailing list