* [PATCH] Don't hash pointers for IPA ICF, instead hash ->order ints (PR ipa/65521)
@ 2015-03-23 15:03 Jakub Jelinek
2015-03-23 15:04 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2015-03-23 15:03 UTC (permalink / raw)
To: Richard Biener, Jan Hubicka, Martin Liška; +Cc: gcc-patches
Hi!
The recent IPA ICF hashing changes broke -fcompare-debug, hashing in
pointers is not stable not just for -fcompare-debug, but supposedly even
just different runs with the exact same options could yield different
assembly. Hashing on DECL_UID is not good either, that is not guaranteed to
be the same for -g/-g0.
symtab_node::order is printed in the -fdump-final-insns= dumps, so I assume
it must be stable across -g/-g0.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2014-03-23 Jakub Jelinek <jakub@redhat.com>
PR ipa/65521
* ipa-icf.c (sem_item::update_hash_by_addr_refs): Hash
ultimate_alias_target ()->order ints instead of
ultimate_alias_target () pointers.
* gcc.dg/pr65521.c: New test.
--- gcc/ipa-icf.c.jj 2015-03-23 08:47:53.000000000 +0100
+++ gcc/ipa-icf.c 2015-03-23 11:02:53.129630089 +0100
@@ -575,7 +575,7 @@ sem_item::update_hash_by_addr_refs (hash
{
ref = node->iterate_reference (i, ref);
if (ref->address_matters_p () || !m_symtab_node_map.get (ref->referred))
- hstate.add_ptr (ref->referred->ultimate_alias_target ());
+ hstate.add_int (ref->referred->ultimate_alias_target ()->order);
}
if (is_a <cgraph_node *> (node))
@@ -585,7 +585,7 @@ sem_item::update_hash_by_addr_refs (hash
{
sem_item **result = m_symtab_node_map.get (e->callee);
if (!result)
- hstate.add_ptr (e->callee->ultimate_alias_target ());
+ hstate.add_int (e->callee->ultimate_alias_target ()->order);
}
}
--- gcc/testsuite/gcc.dg/pr65521.c.jj 2015-03-23 11:03:16.190252436 +0100
+++ gcc/testsuite/gcc.dg/pr65521.c 2015-03-23 11:02:07.000000000 +0100
@@ -0,0 +1,39 @@
+/* PR ipa/65521 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcompare-debug" } */
+
+struct S { int s; };
+int f6 (void *, unsigned long);
+int f7 (int, int *, unsigned long);
+int f8 (void);
+int f9 (void (*) (void));
+
+int
+f1 (void *p)
+{
+ return f6 (p, 256UL);
+}
+
+int
+f2 (void *p)
+{
+ return f6 (p, 256UL);
+}
+
+int
+f3 (struct S *x)
+{
+ return f7 (f8 (), &x->s, 16UL);
+}
+
+int
+f4 (struct S *x)
+{
+ return f7 (f8 (), &x->s, 16UL);
+}
+
+void
+f5 (void)
+{
+ f9 (f5);
+}
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Don't hash pointers for IPA ICF, instead hash ->order ints (PR ipa/65521)
2015-03-23 15:03 [PATCH] Don't hash pointers for IPA ICF, instead hash ->order ints (PR ipa/65521) Jakub Jelinek
@ 2015-03-23 15:04 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2015-03-23 15:04 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Jan Hubicka, Martin Liška, gcc-patches
On Mon, 23 Mar 2015, Jakub Jelinek wrote:
> Hi!
>
> The recent IPA ICF hashing changes broke -fcompare-debug, hashing in
> pointers is not stable not just for -fcompare-debug, but supposedly even
> just different runs with the exact same options could yield different
> assembly. Hashing on DECL_UID is not good either, that is not guaranteed to
> be the same for -g/-g0.
> symtab_node::order is printed in the -fdump-final-insns= dumps, so I assume
> it must be stable across -g/-g0.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
Ok.
Thanks,
Richard.
> 2014-03-23 Jakub Jelinek <jakub@redhat.com>
>
> PR ipa/65521
> * ipa-icf.c (sem_item::update_hash_by_addr_refs): Hash
> ultimate_alias_target ()->order ints instead of
> ultimate_alias_target () pointers.
>
> * gcc.dg/pr65521.c: New test.
>
> --- gcc/ipa-icf.c.jj 2015-03-23 08:47:53.000000000 +0100
> +++ gcc/ipa-icf.c 2015-03-23 11:02:53.129630089 +0100
> @@ -575,7 +575,7 @@ sem_item::update_hash_by_addr_refs (hash
> {
> ref = node->iterate_reference (i, ref);
> if (ref->address_matters_p () || !m_symtab_node_map.get (ref->referred))
> - hstate.add_ptr (ref->referred->ultimate_alias_target ());
> + hstate.add_int (ref->referred->ultimate_alias_target ()->order);
> }
>
> if (is_a <cgraph_node *> (node))
> @@ -585,7 +585,7 @@ sem_item::update_hash_by_addr_refs (hash
> {
> sem_item **result = m_symtab_node_map.get (e->callee);
> if (!result)
> - hstate.add_ptr (e->callee->ultimate_alias_target ());
> + hstate.add_int (e->callee->ultimate_alias_target ()->order);
> }
> }
>
> --- gcc/testsuite/gcc.dg/pr65521.c.jj 2015-03-23 11:03:16.190252436 +0100
> +++ gcc/testsuite/gcc.dg/pr65521.c 2015-03-23 11:02:07.000000000 +0100
> @@ -0,0 +1,39 @@
> +/* PR ipa/65521 */
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -fcompare-debug" } */
> +
> +struct S { int s; };
> +int f6 (void *, unsigned long);
> +int f7 (int, int *, unsigned long);
> +int f8 (void);
> +int f9 (void (*) (void));
> +
> +int
> +f1 (void *p)
> +{
> + return f6 (p, 256UL);
> +}
> +
> +int
> +f2 (void *p)
> +{
> + return f6 (p, 256UL);
> +}
> +
> +int
> +f3 (struct S *x)
> +{
> + return f7 (f8 (), &x->s, 16UL);
> +}
> +
> +int
> +f4 (struct S *x)
> +{
> + return f7 (f8 (), &x->s, 16UL);
> +}
> +
> +void
> +f5 (void)
> +{
> + f9 (f5);
> +}
>
> Jakub
>
>
--
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Jennifer Guild,
Dilip Upmanyu, Graham Norton HRB 21284 (AG Nuernberg)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-23 15:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-23 15:03 [PATCH] Don't hash pointers for IPA ICF, instead hash ->order ints (PR ipa/65521) Jakub Jelinek
2015-03-23 15:04 ` Richard Biener
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).