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 bb-reorder


Hi,

this patch fixes bugs in bb-reorder:
1. the destination which has multiple precessesors and is small
   has to be first selected as continuation, when we want to terminate the
   trace so that it could be duplicated in connect_traces.
2. when testing the length of a trace first check whether the block is a
   start of trace.

Bootstrapped/regtested x86-64.

OK for mainline?

Josef


2003-02-19  Josef Zlomek  <zlomekj at suse dot cz>

	* bb-reorder.c (find_traces_1_round): Fixed condition for small
	destination block with multiple predecessors.
	(connect_traces): Check 


Index: bb-reorder.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/bb-reorder.c,v
retrieving revision 1.54
diff -c -3 -p -r1.54 bb-reorder.c
*** bb-reorder.c	15 Feb 2003 21:22:55 -0000	1.54
--- bb-reorder.c	19 Feb 2003 13:29:23 -0000
*************** find_traces_1_round (branch_th, exec_th,
*** 448,459 ****
  		  || prob < branch_th || freq < exec_th || e->count < count_th)
  		continue;
  
- 	      /* If the destination has multiple precessesors, and can be
- 		 duplicated cheaper than a jump, don't allow it to be added
- 		 to a trace.  We'll duplicate it when connecting traces.  */
- 	      if (e->dest->pred->pred_next && copy_bb_p (e->dest, 0))
- 		continue;
- 
  	      if (better_edge_p (bb, e, prob, freq, best_prob, best_freq))
  		{
  		  best_edge = e;
--- 448,453 ----
*************** find_traces_1_round (branch_th, exec_th,
*** 462,467 ****
--- 456,468 ----
  		}
  	    }
  
+ 	  /* If the best destination has multiple precessesors, and can be
+ 	     duplicated cheaper than a jump, don't allow it to be added
+ 	     to a trace.  We'll duplicate it when connecting traces.  */
+ 	  if (best_edge && best_edge->dest->pred->pred_next
+ 	      && copy_bb_p (best_edge->dest, 0))
+ 	    best_edge = NULL;
+ 
  	  /* Add all non-selected successors to the heaps.  */
  	  for (e = bb->succ; e; e = e->succ_next)
  	    {
*************** connect_traces (n_traces, traces)
*** 922,936 ****
  		    edge best2 = NULL;
  		    int best2_len = 0;
  
! 		    /* If the destination trace is only one block
! 		       long, then no need to search the successor
  		       blocks of the trace.  Accept it.  */
! 		   if (traces[bbd[e->dest->index].start_of_trace].length == 1)
! 		     {
! 		       best = e;
! 		       try_copy = true;
! 		       continue;
! 		     }
  
  		    for (e2 = e->dest->succ; e2; e2 = e2->succ_next)
  		      {
--- 923,939 ----
  		    edge best2 = NULL;
  		    int best2_len = 0;
  
! 		    /* If the destination is a start of a trace which is only
! 		       one block long, then no need to search the successor
  		       blocks of the trace.  Accept it.  */
! 		    if (bbd[e->dest->index].start_of_trace >= 0
! 			&& traces[bbd[e->dest->index].start_of_trace].length
! 			   == 1)
! 		      {
! 			best = e;
! 			try_copy = true;
! 			continue;
! 		      }
  
  		    for (e2 = e->dest->succ; e2; e2 = e2->succ_next)
  		      {


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