summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2012-10-24 18:50:44 +0000
committerPete Cooper <peter_cooper@apple.com>2012-10-24 18:50:44 +0000
commitf4d5a7908decfb6af070882cdd20ad7427f46546 (patch)
treebe84f73aed50d631981e7b71347c09b9ddd255da
parent1c22be69991b1dd9f34f6a9d89129daca0ae3816 (diff)
downloadbcm5719-llvm-f4d5a7908decfb6af070882cdd20ad7427f46546.tar.gz
bcm5719-llvm-f4d5a7908decfb6af070882cdd20ad7427f46546.zip
Improve DenseMap checks for power of 2 growth. Thanks for the tip Jakob
llvm-svn: 166609
-rw-r--r--llvm/include/llvm/ADT/DenseMap.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h
index ce07f8e9c52..ac4bdbd126c 100644
--- a/llvm/include/llvm/ADT/DenseMap.h
+++ b/llvm/include/llvm/ADT/DenseMap.h
@@ -600,8 +600,7 @@ public:
unsigned OldNumBuckets = NumBuckets;
BucketT *OldBuckets = Buckets;
- AtLeast = isPowerOf2_32(AtLeast) ? AtLeast : NextPowerOf2(AtLeast);
- allocateBuckets(std::max<unsigned>(64, AtLeast));
+ allocateBuckets(std::max<unsigned>(64, NextPowerOf2(AtLeast-1)));
assert(Buckets);
if (!OldBuckets) {
this->BaseT::initEmpty();
@@ -827,10 +826,8 @@ public:
}
void grow(unsigned AtLeast) {
- if (AtLeast >= InlineBuckets) {
- AtLeast = isPowerOf2_32(AtLeast) ? AtLeast : NextPowerOf2(AtLeast);
- AtLeast = std::max<unsigned>(64, AtLeast);
- }
+ if (AtLeast >= InlineBuckets)
+ AtLeast = std::max<unsigned>(64, NextPowerOf2(AtLeast-1));
if (Small) {
if (AtLeast < InlineBuckets)
OpenPOWER on IntegriCloud