[PATCH] D120377: [lld-macho] Implement -why_live (without perf overhead)

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 23 08:52:14 PST 2022


int3 added inline comments.


================
Comment at: lld/MachO/MarkLive.cpp:111
+    if (!symbols.empty())
+      lld::errs() << std::string(indent, ' ') << toString(*symbols.front())
+                  << " from " << toString(symbols.front()->getFile()) << "\n";
----------------
thakis wrote:
> can you add a comment on why this doesn't use message()?
oh yeah... I was thinking about how we would handle parallelization in the future, and I realized that `message()` wasn't ideal here because it would take one lock per call, whereas we want to take one lock for the whole of `printWhyLiveImpl` so that the lines wouldn't get interleaved with other concurrent messages. I'll add that comment.


================
Comment at: lld/MachO/MarkLive.cpp:114
   }
+  lld::errs().flush();
+}
----------------
thakis wrote:
> errs() is unbuffered by default, no?
I'd have thought so, but I didn't get messages emitted before adding this `flush()`...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120377/new/

https://reviews.llvm.org/D120377



More information about the llvm-commits mailing list