[lld] [lld][MachO]Multi-threaded i/o. Twice as fast linking a large project. (PR #147134)

John Holdsworth via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 12 05:16:02 PDT 2025


================
@@ -1295,6 +1394,27 @@ static void createFiles(const InputArgList &args) {
       break;
     }
   }
+
+  if (config->readThreads) {
+    multiThreadedPageIn(deferredFiles);
+
+    DeferredFiles archiveContents;
+    std::vector<ArchiveFile *> archives;
+    for (auto &file : deferredFiles)
+      if (ArchiveFile *archive = dyn_cast<ArchiveFile>(
+              processFile(file.buffer, &archiveContents, file.path,
+                          LoadType::CommandLine, file.isLazy)))
+        archives.push_back(archive);
+
+    if (!archiveContents.empty()) {
+      multiThreadedPageIn(archiveContents);
+      for (auto *archive : archives)
+        archive->addLazySymbols();
+    }
+
+    // flush threads
+    multiThreadedPageIn(DeferredFiles());
+  }
----------------
johnno1962 wrote:

I was worried about memory being referenced going out of scope somewhere. Seemed safer to reap the threads.

https://github.com/llvm/llvm-project/pull/147134


More information about the llvm-commits mailing list