[PATCH] InstrProf: Calculate a better function hash

Chandler Carruth chandlerc at google.com
Tue Mar 25 14:33:49 PDT 2014


On Tue, Mar 25, 2014 at 2:30 PM, Chandler Carruth <chandlerc at google.com>wrote:

> Pack the bits of the enum into a 64-bit integer. When we fill the integer,
> spin up an MD5 context, and shove the integer through it, rinse, repeat.
> When done, if you have an MD5, take the upper 64-bits. If not, just take
> the integer.


As a co-worker who also works on hashing just reminded me, this relies on
the fact that none of the enum values are 0, otherwise you end up with 'x'
and 'yx' for two sequences which trivially collide.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140325/5de12fb7/attachment.html>


More information about the cfe-commits mailing list