public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <richard.guenther@gmail.com>
To: Aldy Hernandez <aldyh@redhat.com>
Cc: Richard Henderson <rth@redhat.com>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch] 19/n: trans-mem: middle end/misc patches (LAST PATCH)
Date: Mon, 07 Nov 2011 09:56:00 -0000	[thread overview]
Message-ID: <CAFiYyc0F=vNLtHCnZ79WszMvzun6xW-Qba+5MJ7DoRv1jfJXHQ@mail.gmail.com> (raw)
In-Reply-To: <4EB772DD.7020904@redhat.com>

On Mon, Nov 7, 2011 at 6:55 AM, Aldy Hernandez <aldyh@redhat.com> wrote:
>
>> False.  You get the equivalent of bootstrap comparison mismatches.
>> If we actually used tm during the bootstrap.
>>
>> The simplest thing to do is to change the hash this table uses.
>> E.g. use the DECL_UID right from the start, rather than the pointer.
>
> Woah!  Can it be that easy?  That's as easy as changing the hash, no
> conversion necessary.
>
> OK for branch?

This won't work - DECL_UIDs are not stable -g vs. -g0 - only their
_order_ is stable - thus you won't get comparison fails with code generated
dependent on DECL_UID order, but you will if you depend on the DECL_UID
value (which you do by using it as a hash).

And we will still generate different object files based on garbage collector
settings this way - GC can shrink hashtables, causing re-hashing,
which changes the order of the elements.  It also causes re-ordering
with slight unrelated code changes (but if you say at runtime we always
sort the thing that might not be an issue).

Thus, the patch isn't a fix to get a stable order (you can't get
that for hashtable walks).  A quick fix is to collect the elements
into a VEC and qsort that after some stable key (like the DECL_UID).

Thanks,
Richard.

>        * varasm.c (record_tm_clone_pair): Use DECL_UID as hash.
>        (get_tm_clone_pair): Same.
>
> Index: varasm.c
> ===================================================================
> --- varasm.c    (revision 181067)
> +++ varasm.c    (working copy)
> @@ -5875,7 +5875,7 @@ record_tm_clone_pair (tree o, tree n)
>     tm_clone_pairs = htab_create_ggc (32, tree_map_hash, tree_map_eq, 0);
>
>   h = ggc_alloc_tree_map ();
> -  h->hash = htab_hash_pointer (o);
> +  h->hash = DECL_UID (o);
>   h->base.from = o;
>   h->to = n;
>
> @@ -5892,7 +5892,7 @@ get_tm_clone_pair (tree o)
>       struct tree_map *h, in;
>
>       in.base.from = o;
> -      in.hash = htab_hash_pointer (o);
> +      in.hash = DECL_UID (o);
>       h = (struct tree_map *) htab_find_with_hash (tm_clone_pairs,
>                                                   &in, in.hash);
>       if (h)
>

  reply	other threads:[~2011-11-07  9:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-03 19:58 Aldy Hernandez
2011-11-04 11:22 ` Richard Guenther
2011-11-06 19:07   ` Aldy Hernandez
2011-11-06 20:47     ` Richard Henderson
2011-11-06 22:01       ` Aldy Hernandez
2011-11-07  4:25       ` Aldy Hernandez
2011-11-07  7:53       ` Aldy Hernandez
2011-11-07  9:56         ` Richard Guenther [this message]
2011-11-07 15:54           ` Aldy Hernandez
2011-11-07 16:08             ` Richard Guenther
2011-11-07 17:12               ` Aldy Hernandez
2011-11-06 21:50     ` Richard Henderson
2011-11-07  9:48     ` Richard Guenther
2011-11-07 16:08       ` Aldy Hernandez
2011-11-07 16:14         ` Richard Henderson
2011-11-07 16:23           ` Aldy Hernandez
2011-11-07 16:32             ` Richard Henderson
2011-11-07 16:11       ` Richard Henderson
2011-11-07 17:45       ` Aldy Hernandez
2011-11-07 20:57         ` Aldy Hernandez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFiYyc0F=vNLtHCnZ79WszMvzun6xW-Qba+5MJ7DoRv1jfJXHQ@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).