[lld] [lld][InstrProf] Do not use cstring offset hashes in function order f… (PR #113604)

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


https://github.com/SharonXSharon created https://github.com/llvm/llvm-project/pull/113604


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.

>From 246ba004d249c66e94a1721f59d2e38db10abfc6 Mon Sep 17 00:00:00 2001
From: SharonXSharon <76977260+SharonXSharon at users.noreply.github.com>
Date: Thu, 24 Oct 2024 10:40:01 -0700
Subject: [PATCH] [lld][InstrProf] Do not use cstring offset hashes in function
 order for compression

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.
---
 lld/MachO/BPSectionOrderer.cpp | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lld/MachO/BPSectionOrderer.cpp b/lld/MachO/BPSectionOrderer.cpp
index 07b44d48d65932..94bde485cd40ae 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);
 }



More information about the llvm-commits mailing list