This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix handling of BB_DIRTY when redirecting edge


Hi,
I was looking into possbility that my jump threading work limiting patch
using BB_DIRTY trick would limit optimization possiblilities and there
is one case where it does.
Just threading does one bypass at a time and it miss setting the DIRTY
flag of source block limiting the following bypasses.

Bootstrapped/regtested i686-pc-gnu-linux with no speed regressions.
OK?
2004-01-25  Jan Hubicka  <jh@suse.cz>
	* cfgrtl.c (rtl_redirect_edge_and_branch):  Set the source BB as dirty.
	(cfglayout_redirect_edge_and_branch):  Set the source BB as dirty.
Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.106
diff -c -3 -p -r1.106 cfgrtl.c
*** cfgrtl.c	21 Jan 2004 20:39:52 -0000	1.106
--- cfgrtl.c	25 Jan 2004 01:43:36 -0000
*************** redirect_branch_edge (edge e, basic_bloc
*** 968,973 ****
--- 968,975 ----
  static bool
  rtl_redirect_edge_and_branch (edge e, basic_block target)
  {
+   basic_block src = e->src;
+ 
    if (e->flags & (EDGE_ABNORMAL_CALL | EDGE_EH))
      return false;
  
*************** rtl_redirect_edge_and_branch (edge e, ba
*** 975,985 ****
      return true;
  
    if (try_redirect_by_replacing_jump (e, target, false))
!     return true;
  
    if (!redirect_branch_edge (e, target))
      return false;
  
    return true;
  }
  
--- 977,991 ----
      return true;
  
    if (try_redirect_by_replacing_jump (e, target, false))
!     {
!       src->flags |= BB_DIRTY;
!       return true;
!     }
  
    if (!redirect_branch_edge (e, target))
      return false;
  
+   src->flags |= BB_DIRTY;
    return true;
  }
  
*************** cfg_layout_redirect_edge_and_branch (edg
*** 2440,2446 ****
  
    if (e->src != ENTRY_BLOCK_PTR
        && try_redirect_by_replacing_jump (e, dest, true))
!     return true;
  
    if (e->src == ENTRY_BLOCK_PTR
        && (e->flags & EDGE_FALLTHRU) && !(e->flags & EDGE_COMPLEX))
--- 2446,2455 ----
  
    if (e->src != ENTRY_BLOCK_PTR
        && try_redirect_by_replacing_jump (e, dest, true))
!     {
!       src->flags |= BB_DIRTY;
!       return true;
!     }
  
    if (e->src == ENTRY_BLOCK_PTR
        && (e->flags & EDGE_FALLTHRU) && !(e->flags & EDGE_COMPLEX))
*************** cfg_layout_redirect_edge_and_branch (edg
*** 2449,2454 ****
--- 2458,2464 ----
  	fprintf (rtl_dump_file, "Redirecting entry edge from bb %i to %i\n",
  		 e->src->index, dest->index);
  
+       e->src->flags |= BB_DIRTY;
        redirect_edge_succ (e, dest);
        return true;
      }
*************** cfg_layout_redirect_edge_and_branch (edg
*** 2472,2477 ****
--- 2482,2488 ----
  	  if (!redirect_branch_edge (e, dest))
  	    abort ();
  	  e->flags |= EDGE_FALLTHRU;
+           e->src->flags |= BB_DIRTY;
  	  return true;
  	}
        /* In case we are redirecting fallthru edge to the branch edge
*************** cfg_layout_redirect_edge_and_branch (edg
*** 2499,2504 ****
--- 2510,2516 ----
    if (simplejump_p (BB_END (src)))
      abort ();
  
+   src->flags |= BB_DIRTY;
    return ret;
  }
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]