[lld] [lld][InstrProf] Do not use cstring offset hashes in function order for compression (PR #113606)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 24 11:33:31 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lld-macho

Author: None (SharonXSharon)

<details>
<summary>Changes</summary>


Using the hashes of cstring offset turned to have very minimal impact on the compressed size of large iOS apps. The patch removes that code, thus the cstring symbols will be treated the same way as other defined symbols in terms of hashes calculation.

---
Full diff: https://github.com/llvm/llvm-project/pull/113606.diff


1 Files Affected:

- (modified) lld/MachO/BPSectionOrderer.cpp (+1-4) 


``````````diff
diff --git a/lld/MachO/BPSectionOrderer.cpp b/lld/MachO/BPSectionOrderer.cpp
index 07b44d48d65932..5db2242a35ef28 100644
--- a/lld/MachO/BPSectionOrderer.cpp
+++ b/lld/MachO/BPSectionOrderer.cpp
@@ -53,11 +53,8 @@ getRelocHash(const Reloc &reloc,
     kind = ("Section " + Twine(static_cast<uint8_t>(isec->kind()))).str();
   if (auto *sym = reloc.referent.dyn_cast<Symbol *>()) {
     kind += (" Symbol " + Twine(static_cast<uint8_t>(sym->kind()))).str();
-    if (auto *d = dyn_cast<Defined>(sym)) {
-      if (isa_and_nonnull<CStringInputSection>(isec))
-        return getRelocHash(kind, 0, isec->getOffset(d->value), reloc.addend);
+    if (auto *d = dyn_cast<Defined>(sym))
       return getRelocHash(kind, sectionIdx.value_or(0), d->value, reloc.addend);
-    }
   }
   return getRelocHash(kind, sectionIdx.value_or(0), 0, reloc.addend);
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/113606


More information about the llvm-commits mailing list