[PATCH] Improve PR12245 compile-time by 50%
Mark Mitchell
mark@codesourcery.com
Tue Oct 4 05:50:00 GMT 2005
Richard Guenther wrote:
> ! return (TREE_INT_CST_HIGH (t) ^ TREE_INT_CST_LOW (t)
> ! ^ htab_hash_pointer (TREE_TYPE (t)));
> }
>
> /* Return nonzero if the value represented by *X (an INTEGER_CST tree node)
> --- 712,719 ----
> {
> tree t = (tree) x;
>
> ! return (TREE_INT_CST_HIGH (t) + TREE_INT_CST_LOW (t)
> ! + (long)TREE_TYPE (t));
Shouldn't that cast be to HOST_WIDE_INT? (It can't make for a better
hash function to throw away bits from the inputs....)
And, using + seems a bit unscientific, even if it happens to work well
in this case.
How about the hash_combine function from Boost:
http://www.boost.org/doc/html/hash_combine.html
?
--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304
More information about the Gcc-patches
mailing list