[lld] [lld][ELF] Extend profile guided function ordering to ELF binaries (PR #117514)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 13 12:41:56 PST 2024


================
@@ -102,16 +102,41 @@ class BPSectionELF : public BPSectionBase {
                             &sectionToIdx) const override {
     constexpr unsigned windowSize = 4;
 
-    // Calculate content hashes
     size_t size = isec->content().size();
     for (size_t i = 0; i < size; i++) {
       auto window = isec->content().drop_front(i).take_front(windowSize);
       hashes.push_back(xxHash64(window));
     }
 
-    // TODO: Calculate relocation hashes.
-    // Since in ELF, relocations are complex, but the effect without them are
-    // good enough, we just use 0 as their hash.
+    for (const auto &r : isec->relocations) {
----------------
ellishg wrote:

Nice, it seems good. Did you see an uncompressed or compressed size win with this change?

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


More information about the llvm-commits mailing list