summaryrefslogtreecommitdiff
path: root/COFF
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-08-02 17:33:42 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-08-02 17:33:42 +0000
commit84c4061b34e048f47e5eb4fbabc1558495e8157c (patch)
tree83f9a0fbaadd2f5e3adac8f066cc8160781b385d /COFF
parent20d35e67e67f106f617c939725101223211659f0 (diff)
Notes
Diffstat (limited to 'COFF')
-rw-r--r--COFF/ICF.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/COFF/ICF.cpp b/COFF/ICF.cpp
index 629720901ab84..7feb3c4e0b0c5 100644
--- a/COFF/ICF.cpp
+++ b/COFF/ICF.cpp
@@ -27,6 +27,7 @@
#include "llvm/Support/Debug.h"
#include "llvm/Support/Parallel.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/xxhash.h"
#include <algorithm>
#include <atomic>
#include <vector>
@@ -65,13 +66,6 @@ private:
std::atomic<bool> Repeat = {false};
};
-// Returns a hash value for S.
-uint32_t ICF::getHash(SectionChunk *C) {
- return hash_combine(C->getOutputCharacteristics(), C->SectionName,
- C->Relocs.size(), uint32_t(C->Header->SizeOfRawData),
- C->Checksum, C->getContents());
-}
-
// Returns true if section S is subject of ICF.
//
// Microsoft's documentation
@@ -265,7 +259,7 @@ void ICF::run(ArrayRef<Chunk *> Vec) {
// Initially, we use hash values to partition sections.
for_each(parallel::par, Chunks.begin(), Chunks.end(), [&](SectionChunk *SC) {
// Set MSB to 1 to avoid collisions with non-hash classs.
- SC->Class[0] = getHash(SC) | (1 << 31);
+ SC->Class[0] = xxHash64(SC->getContents()) | (1 << 31);
});
// From now on, sections in Chunks are ordered so that sections in