Fix slow value range hash

Message ID 20180226110452.GA73628@kam.mff.cuni.cz
State New
Headers show
Series
  • Fix slow value range hash
Related show

Commit Message

Jan Hubicka Feb. 26, 2018, 11:04 a.m.
Hi,
this is patch Jakub posted to IRC while discussing slow ipa-cp jump function
streaming. The problem is that hash hashes types as iterative types but later
compares them as pointers.  Iterative hash is trying to make semantically
equivalent types really equivalent.

Alternatively we may try to unify types that are semantically equivalent
but it seems bit slopy to do at stage4.

Bootstrapped/regtested x86_64-linux, OK?

Honza

	patch by Jakub Jelinek
	* ipa-prop.c (ipa_vr_ggc_hash_traits::hash): Hash pointers rather
	than iterative types.

Comments

Jakub Jelinek Feb. 26, 2018, 11:09 a.m. | #1
On Mon, Feb 26, 2018 at 12:04:53PM +0100, Jan Hubicka wrote:
> Hi,

> this is patch Jakub posted to IRC while discussing slow ipa-cp jump function

> streaming. The problem is that hash hashes types as iterative types but later

> compares them as pointers.  Iterative hash is trying to make semantically

> equivalent types really equivalent.

> 

> Alternatively we may try to unify types that are semantically equivalent

> but it seems bit slopy to do at stage4.

> 

> Bootstrapped/regtested x86_64-linux, OK?


Please see http://gcc.gnu.org/r257940 , it is already committed.

	Jakub
Jan Hubicka Feb. 26, 2018, 11:12 a.m. | #2
> On Mon, Feb 26, 2018 at 12:04:53PM +0100, Jan Hubicka wrote:

> > Hi,

> > this is patch Jakub posted to IRC while discussing slow ipa-cp jump function

> > streaming. The problem is that hash hashes types as iterative types but later

> > compares them as pointers.  Iterative hash is trying to make semantically

> > equivalent types really equivalent.

> > 

> > Alternatively we may try to unify types that are semantically equivalent

> > but it seems bit slopy to do at stage4.

> > 

> > Bootstrapped/regtested x86_64-linux, OK?

> 

> Please see http://gcc.gnu.org/r257940 , it is already committed.

Good, can you please backport it to gcc 7?

Thanks,
Honza
> 

> 	Jakub
Jakub Jelinek Feb. 26, 2018, 11:13 a.m. | #3
On Mon, Feb 26, 2018 at 12:12:21PM +0100, Jan Hubicka wrote:
> > On Mon, Feb 26, 2018 at 12:04:53PM +0100, Jan Hubicka wrote:

> > > Hi,

> > > this is patch Jakub posted to IRC while discussing slow ipa-cp jump function

> > > streaming. The problem is that hash hashes types as iterative types but later

> > > compares them as pointers.  Iterative hash is trying to make semantically

> > > equivalent types really equivalent.

> > > 

> > > Alternatively we may try to unify types that are semantically equivalent

> > > but it seems bit slopy to do at stage4.

> > > 

> > > Bootstrapped/regtested x86_64-linux, OK?

> > 

> > Please see http://gcc.gnu.org/r257940 , it is already committed.

> Good, can you please backport it to gcc 7?


Will do within a week, I have dozens of other commits that need backporting.

	Jakub

Patch

Index: ipa-prop.c
===================================================================
--- ipa-prop.c	(revision 257931)
+++ ipa-prop.c	(working copy)
@@ -113,9 +113,10 @@  struct ipa_vr_ggc_hash_traits : public g
   hash (const value_range *p)
   {
     gcc_checking_assert (!p->equiv);
-    hashval_t t = (hashval_t) p->type;
-    t = iterative_hash_expr (p->min, t);
-    return iterative_hash_expr (p->max, t);
+    inchash::hash hstate (p->type);
+    hstate.add_ptr (p->min);
+    hstate.add_ptr (p->max);
+    return hstate.end ();
   }
   static bool
   equal (const value_range *a, const value_range *b)