Enable bb copying in bb-reorder in partitioned functions

Jan Hubicka hubicka@ucw.cz
Thu Jul 20 14:30:00 GMT 2017


Hi,
enabling bb reorering has quite visible code size effect due to disabling two
optimization - the small block duplication in connect_traces and post-reload
crossjumping.  Small block duplication seems easy enough to allow within one
partition.   While doing so i also noticed that my changes to counts disabled
most of duplication which makes code grow.  This is because uninitialized count
is not greater than any threshold.

bootstrapped/regtested x86_64-linux, comitted.

Honza

	* bb-reorder.c (connect_traces): Allow copying of blocks within
	single partition.

Index: bb-reorder.c
===================================================================
--- bb-reorder.c	(revision 250378)
+++ bb-reorder.c	(working copy)
@@ -1302,16 +1302,15 @@ connect_traces (int n_traces, struct tra
 		      }
 		  }
 
-	      if (crtl->has_bb_partition)
-		try_copy = false;
-
 	      /* Copy tiny blocks always; copy larger blocks only when the
 		 edge is traversed frequently enough.  */
 	      if (try_copy
+		  && BB_PARTITION (best->src) == BB_PARTITION (best->dest)
 		  && copy_bb_p (best->dest,
 				optimize_edge_for_speed_p (best)
 				&& EDGE_FREQUENCY (best) >= freq_threshold
-				&& best->count >= count_threshold))
+				&& (!best->count.initialized_p ()
+				    || best->count >= count_threshold)))
 		{
 		  basic_block new_bb;
 



More information about the Gcc-patches mailing list