[llvm] r242179 - Add support for on-disk hash table lookup with a known hash, for situations where the same key will be looked up in multiple tables.

Richard Smith richard-llvm at metafoo.co.uk
Tue Jul 14 11:40:59 PDT 2015


Author: rsmith
Date: Tue Jul 14 13:40:59 2015
New Revision: 242179

URL: http://llvm.org/viewvc/llvm-project?rev=242179&view=rev
Log:
Add support for on-disk hash table lookup with a known hash, for situations where the same key will be looked up in multiple tables.

Modified:
    llvm/trunk/include/llvm/Support/OnDiskHashTable.h

Modified: llvm/trunk/include/llvm/Support/OnDiskHashTable.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/OnDiskHashTable.h?rev=242179&r1=242178&r2=242179&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/OnDiskHashTable.h (original)
+++ llvm/trunk/include/llvm/Support/OnDiskHashTable.h Tue Jul 14 13:40:59 2015
@@ -280,13 +280,19 @@ public:
   };
 
   /// \brief Look up the stored data for a particular key.
-  iterator find(const external_key_type &EKey, Info *InfoPtr = 0) {
-    if (!InfoPtr)
-      InfoPtr = &InfoObj;
-
-    using namespace llvm::support;
+  iterator find(const external_key_type &EKey, Info *InfoPtr = nullptr) {
     const internal_key_type &IKey = InfoObj.GetInternalKey(EKey);
     hash_value_type KeyHash = InfoObj.ComputeHash(IKey);
+    return find_hashed(IKey, KeyHash, InfoPtr);
+  }
+
+  /// \brief Look up the stored data for a particular key with a known hash.
+  iterator find_hashed(const internal_key_type &IKey, hash_value_type KeyHash,
+                       Info *InfoPtr = nullptr) {
+    using namespace llvm::support;
+
+    if (!InfoPtr)
+      InfoPtr = &InfoObj;
 
     // Each bucket is just an offset into the hash table file.
     offset_type Idx = KeyHash & (NumBuckets - 1);





More information about the llvm-commits mailing list