summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-30 05:55:04 +0000
committerChris Lattner <sabre@nondot.org>2009-08-30 05:55:04 +0000
commite08503cd286a026edfb5f63c3d03b26ae62fa93f (patch)
tree97cc4e58f642b3632ef7cc93f7fa606605008551 /llvm
parent520bd0e6895235a8f538564da2dbff789bbd6cb0 (diff)
downloadbcm5719-llvm-e08503cd286a026edfb5f63c3d03b26ae62fa93f.tar.gz
bcm5719-llvm-e08503cd286a026edfb5f63c3d03b26ae62fa93f.zip
make DenseMap::clear() early exit if there is nothing to do.
llvm-svn: 80480
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/ADT/DenseMap.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/include/llvm/ADT/DenseMap.h b/llvm/include/llvm/ADT/DenseMap.h
index b5862a9f011..b220714b36c 100644
--- a/llvm/include/llvm/ADT/DenseMap.h
+++ b/llvm/include/llvm/ADT/DenseMap.h
@@ -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) {
OpenPOWER on IntegriCloud