This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug lto/50165] [4.7 Regression] Huge build time regression (Firefox lto build)
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 24 Aug 2011 10:16:56 +0000
- Subject: [Bug lto/50165] [4.7 Regression] Huge build time regression (Firefox lto build)
- Auto-submitted: auto-generated
- References: <bug-50165-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50165
--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-08-24 10:16:56 UTC ---
(In reply to comment #3)
> The following patch fixes the problem for me:
>
> diff --git a/gcc/data-streamer.h b/gcc/data-streamer.h
> index c413a75..acf1305 100644
> --- a/gcc/data-streamer.h
> +++ b/gcc/data-streamer.h
> @@ -92,12 +92,7 @@ static inline hashval_t
> hash_string_slot_node (const void *p)
> {
> const struct string_slot *ds = (const struct string_slot *) p;
> - hashval_t r = ds->len;
> - int i;
> -
> - for (i = 0; i < ds->len; i++)
> - r = r * 67 + (unsigned)ds->s[i] - 113;
> - return r;
> + return (hashval_t) htab_hash_string (ds->s);
> }
>
> /* Returns nonzero if P1 and P2 are equal. */
> @@ -107,11 +102,7 @@ eq_string_slot_node (const void *p1, const void *p2)
> {
> const struct string_slot *ds1 = (const struct string_slot *) p1;
> const struct string_slot *ds2 = (const struct string_slot *) p2;
> -
> - if (ds1->len == ds2->len)
> - return memcmp (ds1->s, ds2->s, ds1->len) == 0;
> -
> - return 0;
> + return strcmp (ds1->s, ds2->s) == 0;
> }
>
> /* Returns a new bit-packing context for bit-packing into S. */
Can you check if keeping the ds1->len == ds2->len check in eq_string_slot_node
but using strcmp works as well? If not, then it seems ->len is not
properly initialized in all cases (which would explain that changing the
hash is also important).