[llvm-commits] [llvm] r80480 - /llvm/trunk/include/llvm/ADT/DenseMap.h

Chris Lattner sabre at nondot.org
Sat Aug 29 22:55:05 PDT 2009


Author: lattner
Date: Sun Aug 30 00:55:04 2009
New Revision: 80480

URL: http://llvm.org/viewvc/llvm-project?rev=80480&view=rev
Log:
make DenseMap::clear() early exit if there is nothing to do.

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=80480&r1=80479&r2=80480&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/DenseMap.h (original)
+++ llvm/trunk/include/llvm/ADT/DenseMap.h Sun Aug 30 00:55:04 2009
@@ -93,6 +93,8 @@
   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) {





More information about the llvm-commits mailing list