public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Speed up gimple_tree_eq with release checking
@ 2010-12-08 14:55 Richard Guenther
  2010-12-08 16:42 ` Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Guenther @ 2010-12-08 14:55 UTC (permalink / raw)
  To: gcc-patches


The gimplifier is still one part of the compiler that is comparatively
slow.  Looking at profiles lookup_tmp_var and friends stick out, the
following makes expensive rehashing for assertion purposes conditional
on checking.

Applied as obvious.

Of course I've always found this poor mans CSE during gimplification
somewhat odd ...

Richard.

2010-12-08  Richard Guenther  <rguenther@suse.de>

	* gimplify.c (gimple_tree_eq): Assert hashes are equal only
	when checking is enabled.

Index: gcc/gimplify.c
===================================================================
*** gcc/gimplify.c	(revision 167583)
--- gcc/gimplify.c	(working copy)
*************** gimple_tree_eq (const void *p1, const vo
*** 145,153 ****
--- 145,155 ----
    if (!operand_equal_p (t1, t2, 0))
      return 0;
  
+ #ifdef ENABLE_CHECKING
    /* Only allow them to compare equal if they also hash equal; otherwise
       results are nondeterminate, and we fail bootstrap comparison.  */
    gcc_assert (gimple_tree_hash (p1) == gimple_tree_hash (p2));
+ #endif
  
    return 1;
  }

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Speed up gimple_tree_eq with release checking
  2010-12-08 14:55 [PATCH] Speed up gimple_tree_eq with release checking Richard Guenther
@ 2010-12-08 16:42 ` Jakub Jelinek
  2010-12-08 20:26   ` Richard Guenther
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Jelinek @ 2010-12-08 16:42 UTC (permalink / raw)
  To: Richard Guenther; +Cc: gcc-patches

On Wed, Dec 08, 2010 at 03:14:13PM +0100, Richard Guenther wrote:
> 
> The gimplifier is still one part of the compiler that is comparatively
> slow.  Looking at profiles lookup_tmp_var and friends stick out, the
> following makes expensive rehashing for assertion purposes conditional
> on checking.
> 
> Applied as obvious.

It should have been gcc_checking_assert instead...

> 2010-12-08  Richard Guenther  <rguenther@suse.de>
> 
> 	* gimplify.c (gimple_tree_eq): Assert hashes are equal only
> 	when checking is enabled.
> 
> Index: gcc/gimplify.c
> ===================================================================
> *** gcc/gimplify.c	(revision 167583)
> --- gcc/gimplify.c	(working copy)
> *************** gimple_tree_eq (const void *p1, const vo
> *** 145,153 ****
> --- 145,155 ----
>     if (!operand_equal_p (t1, t2, 0))
>       return 0;
>   
> + #ifdef ENABLE_CHECKING
>     /* Only allow them to compare equal if they also hash equal; otherwise
>        results are nondeterminate, and we fail bootstrap comparison.  */
>     gcc_assert (gimple_tree_hash (p1) == gimple_tree_hash (p2));
> + #endif
>   
>     return 1;
>   }

	Jakub

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Speed up gimple_tree_eq with release checking
  2010-12-08 16:42 ` Jakub Jelinek
@ 2010-12-08 20:26   ` Richard Guenther
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Guenther @ 2010-12-08 20:26 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

On Wed, 8 Dec 2010, Jakub Jelinek wrote:

> On Wed, Dec 08, 2010 at 03:14:13PM +0100, Richard Guenther wrote:
> > 
> > The gimplifier is still one part of the compiler that is comparatively
> > slow.  Looking at profiles lookup_tmp_var and friends stick out, the
> > following makes expensive rehashing for assertion purposes conditional
> > on checking.
> > 
> > Applied as obvious.
> 
> It should have been gcc_checking_assert instead...

Doesn't that preserve side-effects?

Richard.

> > 2010-12-08  Richard Guenther  <rguenther@suse.de>
> > 
> > 	* gimplify.c (gimple_tree_eq): Assert hashes are equal only
> > 	when checking is enabled.
> > 
> > Index: gcc/gimplify.c
> > ===================================================================
> > *** gcc/gimplify.c	(revision 167583)
> > --- gcc/gimplify.c	(working copy)
> > *************** gimple_tree_eq (const void *p1, const vo
> > *** 145,153 ****
> > --- 145,155 ----
> >     if (!operand_equal_p (t1, t2, 0))
> >       return 0;
> >   
> > + #ifdef ENABLE_CHECKING
> >     /* Only allow them to compare equal if they also hash equal; otherwise
> >        results are nondeterminate, and we fail bootstrap comparison.  */
> >     gcc_assert (gimple_tree_hash (p1) == gimple_tree_hash (p2));
> > + #endif
> >   
> >     return 1;
> >   }
> 
> 	Jakub
> 
> 

-- 
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-12-08 19:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-08 14:55 [PATCH] Speed up gimple_tree_eq with release checking Richard Guenther
2010-12-08 16:42 ` Jakub Jelinek
2010-12-08 20:26   ` Richard Guenther

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).