aboutsummaryrefslogtreecommitdiff
path: root/lld
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2023-07-19 14:08:13 -0700
committerFangrui Song <i@maskray.me>2023-07-19 14:08:14 -0700
commit1d1f245270ffb739191023cd990ba6d7780026ee (patch)
treee2e087516e95c365c72ddaed4b3143fe14669e7f /lld
parent3d1f89c2e37c4cf9017842a7d04ae07a5e096d08 (diff)
downloadllvm-1d1f245270ffb739191023cd990ba6d7780026ee.zip
llvm-1d1f245270ffb739191023cd990ba6d7780026ee.tar.gz
llvm-1d1f245270ffb739191023cd990ba6d7780026ee.tar.bz2
[COFF] Switch to xxh3_64bits
Similar to recent changes to ELF (e.g., commit f4b4bc2f18dc0e44afde05735fb673d3de4d5c39) and Mach-O to improve hashing performance.
Diffstat (limited to 'lld')
-rw-r--r--lld/COFF/ICF.cpp2
-rw-r--r--lld/COFF/Writer.cpp4
-rw-r--r--lld/test/COFF/icf-safe.s22
3 files changed, 13 insertions, 15 deletions
diff --git a/lld/COFF/ICF.cpp b/lld/COFF/ICF.cpp
index 0abd0aa..37f5e75 100644
--- a/lld/COFF/ICF.cpp
+++ b/lld/COFF/ICF.cpp
@@ -268,7 +268,7 @@ void ICF::run() {
// Initially, we use hash values to partition sections.
parallelForEach(chunks, [&](SectionChunk *sc) {
- sc->eqClass[0] = xxHash64(sc->getContents());
+ sc->eqClass[0] = xxh3_64bits(sc->getContents());
});
// Combine the hashes of the sections referenced by each section into its
diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp
index dc38e88..85568a1 100644
--- a/lld/COFF/Writer.cpp
+++ b/lld/COFF/Writer.cpp
@@ -110,7 +110,7 @@ public:
// "the timestamp field is really a hash", or a 4-byte size field
// followed by that many bytes containing a longer hash (with the
// lowest 4 bytes usually being the timestamp in little-endian order).
- // Consider storing the full 8 bytes computed by xxHash64 here.
+ // Consider storing the full 8 bytes computed by xxh3_64bits here.
fillEntry(d, COFF::IMAGE_DEBUG_TYPE_REPRO, 0, 0, 0);
}
}
@@ -2001,7 +2001,7 @@ void Writer::writeBuildId() {
config->mingw && config->debug && config->pdbPath.empty();
if (config->repro || generateSyntheticBuildId)
- hash = xxHash64(outputFileData);
+ hash = xxh3_64bits(outputFileData);
if (config->repro)
timestamp = static_cast<uint32_t>(hash);
diff --git a/lld/test/COFF/icf-safe.s b/lld/test/COFF/icf-safe.s
index e3a20ed..c2897e9 100644
--- a/lld/test/COFF/icf-safe.s
+++ b/lld/test/COFF/icf-safe.s
@@ -5,26 +5,24 @@
# RUN: lld-link /dll /noentry /out:%t.dll /verbose /opt:noref,icf /export:g3 /export:g4 %t1.obj %t2.obj 2>&1 | FileCheck --check-prefix=EXPORT %s
# RUN: lld-link /dll /noentry /out:%t.dll /verbose /opt:noref,safeicf %t1.obj %t2.obj 2>&1 | FileCheck %s --check-prefix=SAFEICF
-# CHECK-NOT: Selected
-# CHECK: Selected g3
-# CHECK-NEXT: Removed g4
-# CHECK: Selected f1
+# CHECK-NOT: Selected
+# CHECK: Selected f1
# CHECK-NEXT: Removed f2
# CHECK-NEXT: Removed f3
# CHECK-NEXT: Removed f4
-# CHECK-NOT: Removed
-# CHECK-NOT: Selected
+# CHECK-NEXT: Selected g3
+# CHECK-NEXT: Removed g4
+# CHECK-NOT: {{.}}
# EXPORT-NOT: Selected g3
# EXPORT-NOT: Selected g4
-# SAFEICF-NOT: Selected
-# SAFEICF: Selected g3
-# SAFEICF-NEXT: Removed g4
-# SAFEICF: Selected f3
+# SAFEICF-NOT: Selected
+# SAFEICF: Selected f3
# SAFEICF-NEXT: Removed f4
-# SAFEICF-NOT: Removed
-# SAFEICF-NOT: Selected
+# SAFEICF-NEXT: Selected g3
+# SAFEICF-NEXT: Removed g4
+# SAFEICF-NOT: {{.}}
.section .rdata,"dr",one_only,g1
.globl g1