[lld] 359f170 - [lld-macho] Use fixed chunk size for UUID
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 19 17:24:40 PDT 2023
Author: Fangrui Song
Date: 2023-07-19T17:24:36-07:00
New Revision: 359f170f5f712ee714193b46bad45a45656b2c59
URL: https://github.com/llvm/llvm-project/commit/359f170f5f712ee714193b46bad45a45656b2c59
DIFF: https://github.com/llvm/llvm-project/commit/359f170f5f712ee714193b46bad45a45656b2c59.diff
LOG: [lld-macho] Use fixed chunk size for UUID
Chunk size decided by the thread count makes the UUID less deterministic
(e.g. across machines with different core counts.)
Follow ELF and just use a fixed chunksize.
Fixes: https://github.com/llvm/llvm-project/issues/63961
Reviewed By: #lld-macho, keith
Differential Revision: https://reviews.llvm.org/D155761
Added:
Modified:
lld/MachO/Writer.cpp
Removed:
################################################################################
diff --git a/lld/MachO/Writer.cpp b/lld/MachO/Writer.cpp
index 871e4967d313ce..1b0e64abe843ad 100644
--- a/lld/MachO/Writer.cpp
+++ b/lld/MachO/Writer.cpp
@@ -1182,10 +1182,7 @@ void Writer::writeUuid() {
TimeTraceScope timeScope("Computing UUID");
ArrayRef<uint8_t> data{buffer->getBufferStart(), buffer->getBufferEnd()};
- unsigned chunkCount = parallel::strategy.compute_thread_count() * 10;
- // Round-up integer division
- size_t chunkSize = (data.size() + chunkCount - 1) / chunkCount;
- std::vector<ArrayRef<uint8_t>> chunks = split(data, chunkSize);
+ std::vector<ArrayRef<uint8_t>> chunks = split(data, 1024 * 1024);
// Leave one slot for filename
std::vector<uint64_t> hashes(chunks.size() + 1);
SmallVector<std::shared_future<void>> threadFutures;
More information about the llvm-commits
mailing list