[compiler-rt] r212704 - [msan] Switch chained origins hash to murmur2.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Thu Jul 10 12:17:50 PDT 2014


Yes, I'll do it.
I'm still not very happy with the hash table behaviour, as our typical
value distribution is very biased, and maybe we need to build a
specialized hash function. So it will change again soon.


On Thu, Jul 10, 2014 at 9:23 PM, David Blaikie <dblaikie at gmail.com> wrote:
> On Thu, Jul 10, 2014 at 4:02 AM, Evgeniy Stepanov
> <eugeni.stepanov at gmail.com> wrote:
>> Author: eugenis
>> Date: Thu Jul 10 06:02:33 2014
>> New Revision: 212704
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=212704&view=rev
>> Log:
>> [msan] Switch chained origins hash to murmur2.
>
> Should we document that it's murmur2 in a comment and/or put it in
> some reusable function?
>
>>
>> Modified:
>>     compiler-rt/trunk/lib/msan/msan_chained_origin_depot.cc
>>
>> Modified: compiler-rt/trunk/lib/msan/msan_chained_origin_depot.cc
>> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/msan_chained_origin_depot.cc?rev=212704&r1=212703&r2=212704&view=diff
>> ==============================================================================
>> --- compiler-rt/trunk/lib/msan/msan_chained_origin_depot.cc (original)
>> +++ compiler-rt/trunk/lib/msan/msan_chained_origin_depot.cc Thu Jul 10 06:02:33 2014
>> @@ -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; }
>>  };
>>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list