[lld] [llvm] [Coverage][WebAssembly] Keep InstrProf segments during gc (PR #172023)

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 12 18:24:50 PST 2025


================
@@ -181,7 +192,7 @@ void markLive() {
         if (!c->live)
           message("removing unused section " + toString(c));
       for (InputChunk *c : obj->segments)
-        if (!c->live)
+        if (!c->live && !c->isInstrProfSegment)
----------------
sbc100 wrote:

The `c->live` check here is on the individual segment, not the object file.  

The `enqueueRetainedSegments` function simply calls `enqueue` on each individual segment in order to retain it.

We then report which individual segment were removed here.   Does `enqueue` not set the segments `live` bit?   If it doesn't then I'm guessing the segment that are regained using `enqueueRetainedSegments` might also be reported here erroneously as `removing unused section`.

i.e. this seems like maybe working around an existing bug that we should fix?

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


More information about the llvm-commits mailing list