[llvm-commits] [PATCH] RFC: fix some problems in GeneralHash

Meador Inge meadori at gmail.com
Wed Feb 22 07:07:16 PST 2012


On Wed, Feb 22, 2012 at 6:15 AM, Jay Foad <jay.foad at gmail.com> wrote:

> What do you think of the attached patch? It:
>
> 1. Fixes the theoretical problem with GeneralHash::addUnaligned
> returning varying results on big-endian hosts.
> 2. Fixes the strict aliasing problems that foiled my attempt to apply
> Meador's patch to improve uniquing of struct and function types.

I tested my patch plus this one on Fedora 16 with GCC 4.4.6 and it
worked fine.  The memcpy method looks like the way to go.

> 3. Moves GeneralHash::finish and GeneralHash::mix out of line. This is
> just a matter of taste, but the inlined code looked a bit long-winded
> to me.

I would keep them inline.  Even if we outlined them that would be a separate
patch (the outlining made this one harder to review).

Any new unit tests?  I tried to construct one to reproduce this bug, but I
didn't have much luck.  I might be worth adding a more few tests hashing
data of various sizes and alignment.

-- 
# Meador



More information about the llvm-commits mailing list