[lld] [ELF] Add BPSectionOrderer options (#120514) (PR #125559)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 3 20:32:46 PST 2025


================
@@ -98,10 +102,11 @@ static SmallVector<std::pair<unsigned, UtilityNodes>> getUnsForCompression(
     // Merge sections that are nearly identical
     SmallVector<std::pair<unsigned, SmallVector<uint64_t>>> newSectionHashes;
     DenseMap<uint64_t, unsigned> wholeHashToSectionIdx;
+    unsigned threshold = sectionHashes.size() > 10000 ? 5 : 0;
----------------
MaskRay wrote:

I think it's important for tests to show that `--bp-compression-sort=data` actually does something. Therefore, the threshold has to be lowered so that data sections will not all be considered duplicates.... 

I think `sectionHashes.size() > 10000` will work for large applications like yours.

(In the test, --bp-compression-sort=both and --bp-compression-sort=data exhibit the same behavior. Ideally 'both' should actually do something with functions. Reserved for a future patch.)

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


More information about the llvm-commits mailing list