From 0ec87addb7d17b45f68e003e22e96d479a70b070 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 22 Jun 2022 10:58:33 -0400 Subject: [PATCH] [lld/mac] Add a few TimeTraceScopes Identical literal folding takes ~1.4% of the time, and was missing from the trace. Signature computation still needs ~2.2% of the time, so probably worth explicitly marking its contribution to "Write output file" (9.1%) Differential Revision: https://reviews.llvm.org/D128343 --- lld/MachO/Driver.cpp | 1 + lld/MachO/ICF.cpp | 1 + lld/MachO/Writer.cpp | 4 +++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp index eb661afae454..2518f83602eb 100644 --- a/lld/MachO/Driver.cpp +++ b/lld/MachO/Driver.cpp @@ -1073,6 +1073,7 @@ static void gatherInputSections() { } static void foldIdenticalLiterals() { + TimeTraceScope timeScope("Fold identical literals"); // We always create a cStringSection, regardless of whether dedupLiterals is // true. If it isn't, we simply create a non-deduplicating CStringSection. // Either way, we must unconditionally finalize it here. diff --git a/lld/MachO/ICF.cpp b/lld/MachO/ICF.cpp index 515fa7fbbf54..ad029142681f 100644 --- a/lld/MachO/ICF.cpp +++ b/lld/MachO/ICF.cpp @@ -373,6 +373,7 @@ void macho::markSymAsAddrSig(Symbol *s) { } void macho::markAddrSigSymbols() { + TimeTraceScope timeScope("Mark addrsig symbols"); for (InputFile *file : inputFiles) { ObjFile *obj = dyn_cast(file); if (!obj) diff --git a/lld/MachO/Writer.cpp b/lld/MachO/Writer.cpp index 74612409bc53..9395e1a068a3 100644 --- a/lld/MachO/Writer.cpp +++ b/lld/MachO/Writer.cpp @@ -1126,8 +1126,10 @@ void Writer::writeUuid() { } void Writer::writeCodeSignature() { - if (codeSignatureSection) + if (codeSignatureSection) { + TimeTraceScope timeScope("Write code signature"); codeSignatureSection->writeHashes(buffer->getBufferStart()); + } } void Writer::writeOutputFile() {