Re-land: "[Support] Replace HashString with djbHash."
authorJonas Devlieghere <jonas@devlieghere.com>
Mon, 26 Feb 2018 15:16:42 +0000 (15:16 +0000)
committerJonas Devlieghere <jonas@devlieghere.com>
Mon, 26 Feb 2018 15:16:42 +0000 (15:16 +0000)
commit0797c9550ccc679992694ec924c80da2d671d092
tree2568245a15a0220230d5b1841e294425eadefbd9
parent5695e505e8b731808a7f01fdd5df1127e24d19e8
Re-land: "[Support] Replace HashString with djbHash."

This patch removes the HashString function from StringExtraces and
replaces its uses with calls to djbHash from DJB.h.

This change is *almost* NFC. While the algorithm is identical, the
djbHash implementation in StringExtras used 0 as its default seed while
the implementation in DJB uses 5381. The latter has been shown to result
in less collisions and improved avalanching and is used by the DWARF
accelerator tables.

Because some test were implicitly relying on the hash order, I've
reverted to using zero as a seed for the following two files:

  lld/include/lld/Core/SymbolTable.h
  llvm/lib/Support/StringMap.cpp

Differential revision: https://reviews.llvm.org/D43615

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326091 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Frontend/ASTUnit.cpp
lib/Frontend/CacheTokens.cpp
lib/Lex/PTHLexer.cpp
lib/Serialization/ASTCommon.cpp
lib/Serialization/ASTReader.cpp
lib/Serialization/ASTWriter.cpp
lib/Serialization/GlobalModuleIndex.cpp