make DenseMap::clear() early exit if there is nothing to do.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80480 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-08-30 05:55:04 +00:00
parent 0a9ad97b35
commit 32859c71d6

View File

@ -93,6 +93,8 @@ public:
void resize(size_t Size) { grow(Size); }
void clear() {
if (NumEntries == 0 && NumTombstones == 0) return;
// If the capacity of the array is huge, and the # elements used is small,
// shrink the array.
if (NumEntries * 4 < NumBuckets && NumBuckets > 64) {