[PATCH] D99279: [lld-macho] Parallelize UUID hash computation

Vy Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 24 10:52:40 PDT 2021


oontvoo added inline comments.


================
Comment at: lld/MachO/Writer.cpp:921-925
+  std::vector<uint64_t> hashes(chunks.size());
+  parallelForEachN(0, chunks.size(),
+                   [&](size_t i) { hashes[i] = xxHash64(chunks[i]); });
+  uint64_t digest = xxHash64({reinterpret_cast<uint8_t *>(hashes.data()),
+                              hashes.size() * sizeof(uint64_t)});
----------------
Looking at the implementation of xxHash64, I think the `reinterpret_cast<uint8_t *>` is UB. 
Specifically, it tried to iterate the array by `+8`.

How about this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99279



More information about the llvm-commits mailing list