[lld] [lld][MachO] Tail merge strings (PR #161262)
Ellis Hoag via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 1 10:07:19 PDT 2025
================
@@ -1776,8 +1817,24 @@ void DeduplicatedCStringSection::finalizeContents() {
// only need to assign the offset.
piece.outSecOff = it->second;
}
- for (CStringInputSection *isec : inputs)
+ for (CStringInputSection *isec : inputs) {
+ for (const auto &[i, piece] : llvm::enumerate(isec->pieces)) {
+ if (!piece.live)
----------------
ellishg wrote:
That's true. If the string is in `tailMergeMap` then it will be live. However, we can skip the lookup if the string is dead, so this is more for performance than correctness.
https://github.com/llvm/llvm-project/pull/161262
More information about the llvm-commits
mailing list