[PATCH] D155789: [Support] Implement LLVM_ENABLE_REVERSE_ITERATION for StringMap
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 24 13:55:00 PDT 2023
dblaikie added inline comments.
================
Comment at: llvm/lib/Support/StringMap.cpp:89-90
unsigned FullHashValue = xxHash64(Name);
+ if (shouldReverseIterate())
+ FullHashValue = ~FullHashValue;
unsigned BucketNo = FullHashValue & (NumBuckets - 1);
----------------
Does this actually cause reverse iteration? I'd guess it causes some other iteration, but not necessarily reverse? Maybe doesn't really matter, or maybe it'd be good to rename the reverse iteration thing?
(or maybe we could/should move to something more like Abseil that randomizes hash seeds/iteration order more aggressively/broadly, and doesn't require opt-in?)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D155789/new/
https://reviews.llvm.org/D155789
More information about the llvm-commits
mailing list