public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Prevent irreducible loops creation in jump bypassing
@ 2003-03-07 20:05 Zdenek Dvorak
  2003-03-07 22:46 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Zdenek Dvorak @ 2003-03-07 20:05 UTC (permalink / raw)
  To: gcc-patches; +Cc: jh, rth

Hello,

jump bypassing may create irreducible loops; we want to avoid this as
it decreases effectivity of loop optimizer.

Zdenek

Changelog:

	* gcse.c (bypass_block, bypass_conditional_jumps): Do not create
	irreducible loops.

Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.238
diff -c -3 -p -r1.238 gcse.c
*** gcse.c	25 Feb 2003 22:56:27 -0000	1.238
--- gcse.c	7 Mar 2003 15:10:28 -0000
*************** bypass_block (bb, setcc, jump)
*** 4759,4764 ****
--- 4759,4765 ----
    rtx insn, note;
    edge e, enext;
    int i, change;
+   int may_be_loop_header;
  
    insn = (setcc != NULL) ? setcc : jump;
  
*************** bypass_block (bb, setcc, jump)
*** 4769,4774 ****
--- 4770,4783 ----
    if (note)
      find_used_regs (&XEXP (note, 0), NULL);
  
+   may_be_loop_header = false;
+   for (e = bb->pred; e; e = e->pred_next)
+     if (e->flags & EDGE_DFS_BACK)
+       {
+ 	may_be_loop_header = true;
+ 	break;
+       }
+ 
    change = 0;
    for (e = bb->pred; e; e = enext)
      {
*************** bypass_block (bb, setcc, jump)
*** 4780,4785 ****
--- 4789,4801 ----
        if (e->src->index >= bypass_last_basic_block)
  	continue;
  
+       /* The irreducible loops created by redirecting of edges entering the
+ 	 loop from outside would decrease effectivity of some of the following
+ 	 optimalizations, so prevent this.  */
+       if (may_be_loop_header
+ 	  && !(e->flags & EDGE_DFS_BACK))
+ 	continue;
+ 
        for (i = 0; i < reg_use_count; i++)
  	{
  	  struct reg_use *reg_used = &reg_use_table[i];
*************** bypass_conditional_jumps ()
*** 4866,4871 ****
--- 4882,4888 ----
      return 0;
  
    bypass_last_basic_block = last_basic_block;
+   mark_dfs_back_edges ();
  
    changed = 0;
    FOR_BB_BETWEEN (bb, ENTRY_BLOCK_PTR->next_bb->next_bb,

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

* Re: [PATCH] Prevent irreducible loops creation in jump bypassing
  2003-03-07 20:05 [PATCH] Prevent irreducible loops creation in jump bypassing Zdenek Dvorak
@ 2003-03-07 22:46 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2003-03-07 22:46 UTC (permalink / raw)
  To: Zdenek Dvorak; +Cc: gcc-patches, jh

On Fri, Mar 07, 2003 at 09:05:03PM +0100, Zdenek Dvorak wrote:
> 	* gcse.c (bypass_block, bypass_conditional_jumps): Do not create
> 	irreducible loops.

Ok.


r~

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

end of thread, other threads:[~2003-03-07 22:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-07 20:05 [PATCH] Prevent irreducible loops creation in jump bypassing Zdenek Dvorak
2003-03-07 22:46 ` 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).