[PATCH] D121052: [lld-macho][nfc] Reduce size of icfEqClass hash
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 7 00:11:46 PST 2022
int3 updated this revision to Diff 413356.
int3 marked an inline comment as done.
int3 added a comment.
split out unrelated changes
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121052/new/
https://reviews.llvm.org/D121052
Files:
lld/MachO/ICF.cpp
lld/MachO/InputSection.cpp
lld/MachO/InputSection.h
Index: lld/MachO/InputSection.h
===================================================================
--- lld/MachO/InputSection.h
+++ lld/MachO/InputSection.h
@@ -117,7 +117,7 @@
// Points to the surviving section after this one is folded by ICF
ConcatInputSection *replacement = nullptr;
// Equivalence-class ID for ICF
- uint64_t icfEqClass[2] = {0, 0};
+ uint32_t icfEqClass[2] = {0, 0};
// With subsections_via_symbols, most symbols have their own InputSection,
// and for weak symbols (e.g. from inline functions), only the
Index: lld/MachO/InputSection.cpp
===================================================================
--- lld/MachO/InputSection.cpp
+++ lld/MachO/InputSection.cpp
@@ -30,7 +30,7 @@
// can differ based on STL debug levels (e.g. iterator debugging on MSVC's STL),
// so account for that.
static_assert(sizeof(void *) != 8 ||
- sizeof(ConcatInputSection) == sizeof(std::vector<Reloc>) + 96,
+ sizeof(ConcatInputSection) == sizeof(std::vector<Reloc>) + 88,
"Try to minimize ConcatInputSection's size, we create many "
"instances of it");
Index: lld/MachO/ICF.cpp
===================================================================
--- lld/MachO/ICF.cpp
+++ lld/MachO/ICF.cpp
@@ -273,7 +273,7 @@
// Into each origin-section hash, combine all reloc referent section hashes.
for (icfPass = 0; icfPass < 2; ++icfPass) {
parallelForEach(icfInputs, [&](ConcatInputSection *isec) {
- uint64_t hash = isec->icfEqClass[icfPass % 2];
+ uint32_t hash = isec->icfEqClass[icfPass % 2];
for (const Reloc &r : isec->relocs) {
if (auto *sym = r.referent.dyn_cast<Symbol *>()) {
if (auto *defined = dyn_cast<Defined>(sym)) {
@@ -293,7 +293,7 @@
}
}
// Set MSB to 1 to avoid collisions with non-hashed classes.
- isec->icfEqClass[(icfPass + 1) % 2] = hash | (1ull << 63);
+ isec->icfEqClass[(icfPass + 1) % 2] = hash | (1ull << 31);
});
}
@@ -400,7 +400,7 @@
assert(isec->icfEqClass[0] == 0); // don't overwrite a unique ID!
// Turn-on the top bit to guarantee that valid hashes have no collisions
// with the small-integer unique IDs for ICF-ineligible sections
- isec->icfEqClass[0] = xxHash64(isec->data) | (1ull << 63);
+ isec->icfEqClass[0] = xxHash64(isec->data) | (1ull << 31);
});
// Now that every input section is either hashed or marked as unique, run the
// segregation algorithm to detect foldable subsections.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121052.413356.patch
Type: text/x-patch
Size: 2540 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220307/b3c855d3/attachment.bin>
More information about the llvm-commits
mailing list