[PATCH] D128298: [lld/mac] Parallelize code signature computation

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 21 17:41:55 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG0baf13e282ab: [lld/mac] Parallelize code signature computation (authored by thakis).
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D128298

Files:
  lld/MachO/SyntheticSections.cpp


Index: lld/MachO/SyntheticSections.cpp
===================================================================
--- lld/MachO/SyntheticSections.cpp
+++ lld/MachO/SyntheticSections.cpp
@@ -22,6 +22,7 @@
 #include "llvm/Support/EndianStream.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/LEB128.h"
+#include "llvm/Support/Parallel.h"
 #include "llvm/Support/Path.h"
 
 #if defined(__APPLE__)
@@ -1247,11 +1248,11 @@
   // NOTE: Changes to this functionality should be repeated in llvm-objcopy's
   // MachOWriter::writeSignatureData.
   uint8_t *hashes = buf + fileOff + allHeadersSize;
-  for (uint64_t i = 0; i < getBlockCount(); ++i) {
+  parallelFor(0, getBlockCount(), [&](size_t i) {
     sha256(buf + i * blockSize,
            std::min(static_cast<size_t>(fileOff - i * blockSize), blockSize),
            hashes + i * hashSize);
-  }
+  });
 #if defined(__APPLE__)
   // This is macOS-specific work-around and makes no sense for any
   // other host OS. See https://openradar.appspot.com/FB8914231


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128298.438881.patch
Type: text/x-patch
Size: 1018 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220622/a1b9f206/attachment.bin>


More information about the llvm-commits mailing list