public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Tree profilng merge 1 - allow inserting onto edge to EXIT_BLOCK
@ 2004-05-28 14:00 Jan Hubicka
  2004-06-02  4:12 ` Jeffrey A Law
  2004-06-07  0:50 ` Richard Henderson
  0 siblings, 2 replies; 9+ messages in thread
From: Jan Hubicka @ 2004-05-28 14:00 UTC (permalink / raw)
  To: gcc-patches, rth

Hi,
for bootstrap with tree profiling we must be able to split edges to
EXIT_BLOCK.  This has been discussed with RTH on irc in the past

Honza

Bootstrapped/regtested i686-pc-gnu-linux without libjava, of course will
re-test with libjava if approved.  OK?

2004-05-28  Jan Hubicka  <jh@suse.cz>
	* gimple-low.c (tree_find_edge_insert_loc):  Allow inserting before
	return_stmt.
Index: gimple-low.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gimple-low.c,v
retrieving revision 2.2
retrieving revision 1.1.4.17.2.7
diff -c -3 -p -r2.2 -r1.1.4.17.2.7
*************** tree_find_edge_insert_loc (edge e, block
*** 2834,2839 ****
--- 2858,2879 ----
        tmp = bsi_stmt (*bsi);
        if (!stmt_ends_bb_p (tmp))
  	return true;
+ 
+       /* Insert code just before returning the value.  We may need to decompose
+          the return in the case it contains non-trivial operand.  */
+       if (TREE_CODE (tmp) == RETURN_EXPR)
+         {
+ 	  tree op = TREE_OPERAND (tmp, 0);
+ 	  if (!is_gimple_val (op))
+ 	    {
+ 	      if (TREE_CODE (op) != MODIFY_EXPR)
+ 		abort ();
+ 	      bsi_insert_before (bsi, op, BSI_NEW_STMT);
+ 	      TREE_OPERAND (tmp, 0) = TREE_OPERAND (op, 0);
+ 	    }
+ 	  bsi_prev (bsi);
+ 	  return true;
+         }
      }
  
    /* Otherwise, create a new basic block, and split this edge.  */

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

* Re: Tree profilng merge 1 - allow inserting onto edge to EXIT_BLOCK
  2004-05-28 14:00 Tree profilng merge 1 - allow inserting onto edge to EXIT_BLOCK Jan Hubicka
@ 2004-06-02  4:12 ` Jeffrey A Law
  2004-06-07  0:50 ` Richard Henderson
  1 sibling, 0 replies; 9+ messages in thread
From: Jeffrey A Law @ 2004-06-02  4:12 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc-patches, rth

On Fri, 2004-05-28 at 04:52, Jan Hubicka wrote:
> Hi,
> for bootstrap with tree profiling we must be able to split edges to
> EXIT_BLOCK.  This has been discussed with RTH on irc in the past
> 
> Honza
> 
> Bootstrapped/regtested i686-pc-gnu-linux without libjava, of course will
> re-test with libjava if approved.  OK?
> 
> 2004-05-28  Jan Hubicka  <jh@suse.cz>
> 	* gimple-low.c (tree_find_edge_insert_loc):  Allow inserting before
> 	return_stmt.
This is fine.  Please install this patch.

jeff



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

* Re: Tree profilng merge 1 - allow inserting onto edge to EXIT_BLOCK
  2004-05-28 14:00 Tree profilng merge 1 - allow inserting onto edge to EXIT_BLOCK Jan Hubicka
  2004-06-02  4:12 ` Jeffrey A Law
@ 2004-06-07  0:50 ` Richard Henderson
  2004-06-07 14:32   ` Jeffrey A Law
  2004-06-08 14:55   ` Jan Hubicka
  1 sibling, 2 replies; 9+ messages in thread
From: Richard Henderson @ 2004-06-07  0:50 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: gcc-patches

On Fri, May 28, 2004 at 12:52:45PM +0200, Jan Hubicka wrote:
> 	* gimple-low.c (tree_find_edge_insert_loc):  Allow inserting before
> 	return_stmt.

Wait on this.  Jason and I talked about redefining things such that
we only ever have one RETURN_EXPR in a function, and that it always
only contains just the result_decl.

I have the solution prototyped; we'll see what kind of uglies I run
into.


r~

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

* Re: Tree profilng merge 1 - allow inserting onto edge to EXIT_BLOCK
  2004-06-07  0:50 ` Richard Henderson
@ 2004-06-07 14:32   ` Jeffrey A Law
  2004-06-07 15:39     ` Paolo Bonzini
  2004-06-08 14:55   ` Jan Hubicka
  1 sibling, 1 reply; 9+ messages in thread
From: Jeffrey A Law @ 2004-06-07 14:32 UTC (permalink / raw)
  To: Richard Henderson; +Cc: Jan Hubicka, gcc-patches

On Sun, 2004-06-06 at 17:45, Richard Henderson wrote:
> On Fri, May 28, 2004 at 12:52:45PM +0200, Jan Hubicka wrote:
> > 	* gimple-low.c (tree_find_edge_insert_loc):  Allow inserting before
> > 	return_stmt.
> 
> Wait on this.  Jason and I talked about redefining things such that
> we only ever have one RETURN_EXPR in a function, and that it always
> only contains just the result_decl.
> 
> I have the solution prototyped; we'll see what kind of uglies I run
> into.
Keep me informed -- how you do this has some implications for
Andrew's code (which I've taken review responsibility for) to
optimize stuff like

if (cond)
  return x;
else
  return y;

Jeff


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

* Re: Tree profilng merge 1 - allow inserting onto edge to EXIT_BLOCK
  2004-06-07 14:32   ` Jeffrey A Law
@ 2004-06-07 15:39     ` Paolo Bonzini
  2004-06-07 18:40       ` Richard Henderson
  0 siblings, 1 reply; 9+ messages in thread
From: Paolo Bonzini @ 2004-06-07 15:39 UTC (permalink / raw)
  To: gcc-patches; +Cc: law

Jeffrey A Law wrote:

> Keep me informed -- how you do this has some implications for
> Andrew's code (which I've taken review responsibility for) to
> optimize stuff like
 >
 > if (cond)
 >   return x;
 > else
 >   return y;

I planned to do this as part of a general rewrite of phiopt (see earlier 
message to the list in which I CCed you).  Is Andrew rewriting this to

  if (cond)
    T = x;
  else
    T = y;
   return T;

?

Paolo

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

* Re: Tree profilng merge 1 - allow inserting onto edge to EXIT_BLOCK
  2004-06-07 15:39     ` Paolo Bonzini
@ 2004-06-07 18:40       ` Richard Henderson
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 2004-06-07 18:40 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: gcc-patches, law

On Mon, Jun 07, 2004 at 04:12:23PM +0200, Paolo Bonzini wrote:
> I planned to do this as part of a general rewrite of phiopt (see earlier 
> message to the list in which I CCed you).  Is Andrew rewriting this to
> 
>  if (cond)
>    T = x;
>  else
>    T = y;
>   return T;

My patch does this.  In the process of committing it now...


r~

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

* Re: Tree profilng merge 1 - allow inserting onto edge to EXIT_BLOCK
  2004-06-07  0:50 ` Richard Henderson
  2004-06-07 14:32   ` Jeffrey A Law
@ 2004-06-08 14:55   ` Jan Hubicka
  1 sibling, 0 replies; 9+ messages in thread
From: Jan Hubicka @ 2004-06-08 14:55 UTC (permalink / raw)
  To: Richard Henderson, Jan Hubicka, gcc-patches

> On Fri, May 28, 2004 at 12:52:45PM +0200, Jan Hubicka wrote:
> > 	* gimple-low.c (tree_find_edge_insert_loc):  Allow inserting before
> > 	return_stmt.
> 
> Wait on this.  Jason and I talked about redefining things such that
> we only ever have one RETURN_EXPR in a function, and that it always
> only contains just the result_decl.

What are the major advantages of this (except for having easier job in
the RTL expansion)
> 
> I have the solution prototyped; we'll see what kind of uglies I run
> into.

The patch ahs been approved by Jeff so I think I already applied it, so
please just revert it if you have something better.

Honza
> 
> 
> r~

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

* Re: Tree profilng merge 1 - allow inserting onto edge to EXIT_BLOCK
  2004-06-07  0:55 Richard Kenner
@ 2004-06-07  6:10 ` Richard Henderson
  0 siblings, 0 replies; 9+ messages in thread
From: Richard Henderson @ 2004-06-07  6:10 UTC (permalink / raw)
  To: Richard Kenner; +Cc: gcc-patches

On Sun, Jun 06, 2004 at 07:48:25PM -0400, Richard Kenner wrote:
>     Wait on this.  Jason and I talked about redefining things such that
>     we only ever have one RETURN_EXPR in a function, and that it always
>     only contains just the result_decl.
> 
> Would this be visible to front ends or done during gimplification?

During and after gimplification.


r~

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

* Re: Tree profilng merge 1 - allow inserting onto edge to EXIT_BLOCK
@ 2004-06-07  0:55 Richard Kenner
  2004-06-07  6:10 ` Richard Henderson
  0 siblings, 1 reply; 9+ messages in thread
From: Richard Kenner @ 2004-06-07  0:55 UTC (permalink / raw)
  To: rth; +Cc: gcc-patches

    Wait on this.  Jason and I talked about redefining things such that
    we only ever have one RETURN_EXPR in a function, and that it always
    only contains just the result_decl.

Would this be visible to front ends or done during gimplification?

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

end of thread, other threads:[~2004-06-08 13:37 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-28 14:00 Tree profilng merge 1 - allow inserting onto edge to EXIT_BLOCK Jan Hubicka
2004-06-02  4:12 ` Jeffrey A Law
2004-06-07  0:50 ` Richard Henderson
2004-06-07 14:32   ` Jeffrey A Law
2004-06-07 15:39     ` Paolo Bonzini
2004-06-07 18:40       ` Richard Henderson
2004-06-08 14:55   ` Jan Hubicka
2004-06-07  0:55 Richard Kenner
2004-06-07  6:10 ` Richard Henderson

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