aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/StringMap.cpp
diff options
context:
space:
mode:
authorserge-sans-paille <sguelton@redhat.com>2021-02-24 16:15:24 +0100
committerserge-sans-paille <sguelton@redhat.com>2021-03-01 13:21:27 +0100
commitd84440ec919019ac446241db72cfd905c6ac9dfa (patch)
tree462ec3bdc26d6b17a9021c8bbf0a9430cbe7017b /llvm/lib/Support/StringMap.cpp
parent3fea9226eecd2069bea93c4fe5955b0b5ff316f7 (diff)
downloadllvm-d84440ec919019ac446241db72cfd905c6ac9dfa.zip
llvm-d84440ec919019ac446241db72cfd905c6ac9dfa.tar.gz
llvm-d84440ec919019ac446241db72cfd905c6ac9dfa.tar.bz2
Use the default seed value for djb hash for StringMap
See original comment in 560ce2c70fb1fe8e4b9b5e39c54e494a50373ba8 Baiscally the default seed value results in less collision, but changes the iteration order, which matters for a few test cases. Differential Revision: https://reviews.llvm.org/D97396
Diffstat (limited to 'llvm/lib/Support/StringMap.cpp')
-rw-r--r--llvm/lib/Support/StringMap.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/StringMap.cpp b/llvm/lib/Support/StringMap.cpp
index f65d384..69a144f 100644
--- a/llvm/lib/Support/StringMap.cpp
+++ b/llvm/lib/Support/StringMap.cpp
@@ -77,7 +77,7 @@ unsigned StringMapImpl::LookupBucketFor(StringRef Name) {
init(16);
HTSize = NumBuckets;
}
- unsigned FullHashValue = djbHash(Name, 0);
+ unsigned FullHashValue = djbHash(Name);
unsigned BucketNo = FullHashValue & (HTSize - 1);
unsigned *HashTable = (unsigned *)(TheTable + NumBuckets + 1);
@@ -133,7 +133,7 @@ int StringMapImpl::FindKey(StringRef Key) const {
unsigned HTSize = NumBuckets;
if (HTSize == 0)
return -1; // Really empty table?
- unsigned FullHashValue = djbHash(Key, 0);
+ unsigned FullHashValue = djbHash(Key);
unsigned BucketNo = FullHashValue & (HTSize - 1);
unsigned *HashTable = (unsigned *)(TheTable + NumBuckets + 1);