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

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 14 13:49:04 PDT 2021


aganea added inline comments.


================
Comment at: lld/COFF/DebugTypes.cpp:1018
   {
+    Timer loadGHashTimer("Global Type Hashing", parentTimer);
     ScopedTimer t1(loadGHashTimer);
----------------
`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)


================
Comment at: lld/COFF/ICF.cpp:249
+void ICF::run(COFFLinkerContext &ctx) {
+  Timer icfTimer("ICF", ctx.rootTimer);
   ScopedTimer t(icfTimer);
----------------
Same here, move this `Timer` into `class ICF`.


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