[lld] 0ec87ad - [lld/mac] Add a few TimeTraceScopes

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 23 08:47:03 PDT 2022


Author: Nico Weber
Date: 2022-06-23T11:46:57-04:00
New Revision: 0ec87addb7d17b45f68e003e22e96d479a70b070

URL: https://github.com/llvm/llvm-project/commit/0ec87addb7d17b45f68e003e22e96d479a70b070
DIFF: https://github.com/llvm/llvm-project/commit/0ec87addb7d17b45f68e003e22e96d479a70b070.diff

LOG: [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

Added: 
    

Modified: 
    lld/MachO/Driver.cpp
    lld/MachO/ICF.cpp
    lld/MachO/Writer.cpp

Removed: 
    


################################################################################
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<ObjFile>(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() {


        


More information about the llvm-commits mailing list