[PATCH] InstrProf: Calculate a better function hash

Duncan P. N. Exon Smith dexonsmith at apple.com
Tue Mar 25 17:40:17 PDT 2014


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

> 
> 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.

Right.  I’ll be careful about that.



More information about the cfe-commits mailing list