[lld] 0405920 - Re-land [lld-macho][nfc] Don't use `stubsHelperIndex` in ICF hash
Jez Ng via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 7 13:58:21 PST 2022
Author: Jez Ng
Date: 2022-03-07T16:58:00-05:00
New Revision: 0405920c5faa1665bfcb40e2abdcaede2031a31b
URL: https://github.com/llvm/llvm-project/commit/0405920c5faa1665bfcb40e2abdcaede2031a31b
DIFF: https://github.com/llvm/llvm-project/commit/0405920c5faa1665bfcb40e2abdcaede2031a31b.diff
LOG: Re-land [lld-macho][nfc] Don't use `stubsHelperIndex` in ICF hash
Previous attempt was commit 112135e77444e8c8106efa77416af09f4b9a5012 and
reverted in d86d431814c836ec5579fc0b981e86c7fb81f2f2.
Added:
Modified:
lld/MachO/ICF.cpp
Removed:
################################################################################
diff --git a/lld/MachO/ICF.cpp b/lld/MachO/ICF.cpp
index efcd3c07ab8ee..b760effa7321f 100644
--- a/lld/MachO/ICF.cpp
+++ b/lld/MachO/ICF.cpp
@@ -278,9 +278,7 @@ void ICF::run() {
uint32_t hash = isec->icfEqClass[icfPass % 2];
for (const Reloc &r : isec->relocs) {
if (auto *sym = r.referent.dyn_cast<Symbol *>()) {
- if (auto *dylibSym = dyn_cast<DylibSymbol>(sym))
- hash += dylibSym->stubsHelperIndex;
- else if (auto *defined = dyn_cast<Defined>(sym)) {
+ if (auto *defined = dyn_cast<Defined>(sym)) {
if (defined->isec) {
if (auto referentIsec =
dyn_cast<ConcatInputSection>(defined->isec))
@@ -291,8 +289,10 @@ void ICF::run() {
} else {
hash += defined->value;
}
- } else if (!isa<Undefined>(sym)) // ICF runs before Undefined diags.
- llvm_unreachable("foldIdenticalSections symbol kind");
+ } else {
+ // ICF runs before Undefined diags
+ assert(isa<Undefined>(sym) || isa<DylibSymbol>(sym));
+ }
}
}
// Set MSB to 1 to avoid collisions with non-hashed classes.
More information about the llvm-commits
mailing list