[PATCH] D38528: Parallelize tail-merge string table construction.
Bob Haarman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 8 18:33:57 PST 2018
inglorion added inline comments.
================
Comment at: lld/ELF/SyntheticSections.cpp:2276
+static uint32_t tailHash(StringRef S) {
+ if (S.size() < 4)
----------------
What if you did the equivalent of:
size_t N = std::min(4, S.size());
uint32_t X = 0;
memcpy(&X, S.data() + S.size() - N, N);
return hash_value(X);
That would allow you to handle strings of any length and should be super efficient.
If you need the hash to not depend on the endianness of the host you could use ulittle32_t, but I think in this case you don't need to care what the actual values produced by the hash function are so ignoring endianness seems fine.
https://reviews.llvm.org/D38528
More information about the llvm-commits
mailing list