[PATCH] D109634: [LLD] Remove global state in lld/COFF

Amy Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 14 18:32:19 PDT 2021


akhuang added inline comments.


================
Comment at: lld/COFF/DebugTypes.cpp:1018
   {
+    Timer loadGHashTimer("Global Type Hashing", parentTimer);
     ScopedTimer t1(loadGHashTimer);
----------------
aganea wrote:
> `Timer`s cannot be function-local otherwise `rootTimer` will end up with a list of dangling pointers in `lld::Timer::children`. The best would be to keep the `Timer`s alive in other structures until `Timer::root().print()` is called (at the end of `LinkerDriver::linkerMain()`. The comment applies to all others `Timer` instances below.
> 
> Could you possibly ensure that the output of `link.exe @something.rsp /time` before & after this patch is the same please? (with inputs that exercise all `Timer`s)
ohh right, hmm, I think a lot of the classes also go out of scope before we print the final timers, guess I'll put them all in the Context class...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D109634



More information about the llvm-commits mailing list