[lld] [Coverage][WebAssembly] Discard InstrProf sections if object not live (PR #172023)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 13 11:01:37 PST 2025
================
@@ -153,6 +154,12 @@ void Writer::calculateCustomSections() {
// Strip debug section in that option was specified.
if (stripDebug && name.starts_with(".debug_"))
continue;
+ // If the object is not live, discard `__llvm_covfun` and `__llvm_covmap`
+ // sections since `__llvm_prf_*` segments have already been discarded.
+ if (!file->isLive() &&
+ (name == getInstrProfSectionName(IPSK_covfun, Triple::Wasm) ||
+ name == getInstrProfSectionName(IPSK_covmap, Triple::Wasm)))
+ continue;
----------------
Spxg wrote:
> Hmm.. I wonder if we can just add if (!file->isLive()) continue to the outer loop here.
LGTM, but it's not only `calculateCustomSections` that is used in this way, also `populateProducers` etc.. It might be necessary to determine whether it's a `non-live` object at an earlier stage and exit.
Anyway, I'm not really in favor of doing it in this PR (because the cov issue is clear, it should be given priority consideration), it might cause the problem to escalate.
https://github.com/llvm/llvm-project/pull/172023
More information about the llvm-commits
mailing list