diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2018-08-02 17:33:42 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2018-08-02 17:33:42 +0000 |
commit | 84c4061b34e048f47e5eb4fbabc1558495e8157c (patch) | |
tree | 83f9a0fbaadd2f5e3adac8f066cc8160781b385d /ELF/ICF.cpp | |
parent | 20d35e67e67f106f617c939725101223211659f0 (diff) |
Notes
Diffstat (limited to 'ELF/ICF.cpp')
-rw-r--r-- | ELF/ICF.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/ELF/ICF.cpp b/ELF/ICF.cpp index ba413b132658..075938bd16b9 100644 --- a/ELF/ICF.cpp +++ b/ELF/ICF.cpp @@ -80,9 +80,10 @@ #include "SyntheticSections.h" #include "Writer.h" #include "lld/Common/Threads.h" -#include "llvm/ADT/Hashing.h" +#include "llvm/ADT/StringExtras.h" #include "llvm/BinaryFormat/ELF.h" #include "llvm/Object/ELF.h" +#include "llvm/Support/xxhash.h" #include <algorithm> #include <atomic> @@ -155,12 +156,6 @@ private: }; } -// Returns a hash value for S. Note that the information about -// relocation targets is not included in the hash value. -template <class ELFT> static uint32_t getHash(InputSection *S) { - return hash_combine(S->Flags, S->getSize(), S->NumRelocations, S->Data); -} - // Returns true if section S is subject of ICF. static bool isEligible(InputSection *S) { if (!S->Live || S->KeepUnique || !(S->Flags & SHF_ALLOC)) @@ -441,7 +436,7 @@ template <class ELFT> void ICF<ELFT>::run() { // Initially, we use hash values to partition sections. parallelForEach(Sections, [&](InputSection *S) { // Set MSB to 1 to avoid collisions with non-hash IDs. - S->Class[0] = getHash<ELFT>(S) | (1U << 31); + S->Class[0] = xxHash64(S->Data) | (1U << 31); }); // From now on, sections in Sections vector are ordered so that sections |