[PATCH] D54809: COFF: ICF: Include contents of referenced sections in initial partitioning hash. NFCI.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 21 13:32:19 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL347429: COFF: ICF: Include contents of referenced sections in initial partitioning hash. (authored by pcc, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D54809?vs=174972&id=174975#toc
Repository:
rL LLVM
https://reviews.llvm.org/D54809
Files:
lld/trunk/COFF/ICF.cpp
Index: lld/trunk/COFF/ICF.cpp
===================================================================
--- lld/trunk/COFF/ICF.cpp
+++ lld/trunk/COFF/ICF.cpp
@@ -262,8 +262,18 @@
// Initially, we use hash values to partition sections.
for_each(parallel::par, Chunks.begin(), Chunks.end(), [&](SectionChunk *SC) {
+ SC->Class[1] = xxHash64(SC->getContents());
+ });
+
+ // Combine the hashes of the sections referenced by each section into its
+ // hash.
+ for_each(parallel::par, Chunks.begin(), Chunks.end(), [&](SectionChunk *SC) {
+ uint32_t Hash = SC->Class[1];
+ for (Symbol *B : SC->symbols())
+ if (auto *Sym = dyn_cast_or_null<DefinedRegular>(B))
+ Hash ^= Sym->getChunk()->Class[1];
// Set MSB to 1 to avoid collisions with non-hash classs.
- SC->Class[0] = xxHash64(SC->getContents()) | (1 << 31);
+ SC->Class[0] = Hash | (1U << 31);
});
// From now on, sections in Chunks are ordered so that sections in
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54809.174975.patch
Type: text/x-patch
Size: 961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181121/fb4f911f/attachment.bin>
More information about the llvm-commits
mailing list