[PATCH] D53968: [LLD]fix windows mingw build with 'LLVM_LINK_LLVM_DYLIB' the lld will hang when exiting

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 5 01:18:10 PST 2018


mstorsjo added a comment.

In https://reviews.llvm.org/D53968#1286945, @ruiu wrote:

> I don't think I understand what could run as a result of destructing the thread pool executor on exit. My guess is that it calls the destructors of thread-local global objects and then call the operating system to kill threads. If that's the case, the cost of doing that should be negligible because we don't have any thread-local globals. But is that understanding correct?


I guess so, plus the overhead of actually joining and waiting for all the threads to complete.

Put another way though; lld currently exits with `_exit` instead of `exit` explicitly to skip running destructors, for performance reasons. If you have a case where you can measure the difference between these two, to conclude that the distinction is worthwhile, it should be easy to measure the impact of this patch, whether it still keeps the same beneficial tradeoff as before, or if it goes closer to the case of `exit` with running all destructors, which we explicitly didn't want to.

If it's isn't doable to actually measure any such difference, I would say this patch also should be fine because whatever difference it makes is within the unmeasurable range.


Repository:
  rL LLVM

https://reviews.llvm.org/D53968





More information about the llvm-commits mailing list