From c2c435f95d6ef7a559131be4e663ac06f4f9aaf0 Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Thu, 10 Jul 2014 11:02:33 +0000 Subject: [PATCH] [msan] Switch chained origins hash to murmur2. llvm-svn: 212704 --- compiler-rt/lib/msan/msan_chained_origin_depot.cc | 25 ++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/compiler-rt/lib/msan/msan_chained_origin_depot.cc b/compiler-rt/lib/msan/msan_chained_origin_depot.cc index 95f0a804..faf0461 100644 --- a/compiler-rt/lib/msan/msan_chained_origin_depot.cc +++ b/compiler-rt/lib/msan/msan_chained_origin_depot.cc @@ -19,7 +19,30 @@ namespace __msan { struct ChainedOriginDepotDesc { u32 here_id; u32 prev_id; - u32 hash() const { return (here_id * 0x1f1f1f1f) ^ prev_id; } + u32 hash() const { + const u32 m = 0x5bd1e995; + const u32 seed = 0x9747b28c; + const u32 r = 24; + u32 h = seed; + u32 k = here_id; + k *= m; + k ^= k >> r; + k *= m; + h *= m; + h ^= k; + + k = prev_id; + k *= m; + k ^= k >> r; + k *= m; + h *= m; + h ^= k; + + h ^= h >> 13; + h *= m; + h ^= h >> 15; + return h; + } bool is_valid() { return true; } }; -- 2.7.4