bb-reorder tweek

Jan Hubicka hubicka@ucw.cz
Thu Jul 6 16:15:00 GMT 2017


Hi,
while reading bb-reorder code I noticed that it now may pick edge with probability 0
as one preferred over edge with undefined probability.  This is not quite intended.
Also we never want to make the trace to go across abnormal/eh edge.

Bootstrapped/regtested x86_64-linux, will commit it shortly.

Honza

	* bb-reorder.c (better_edge_p): Do not build traces across abnormal/eh
	edges; zero probability is not better than uninitialized.

Index: bb-reorder.c
===================================================================
--- bb-reorder.c	(revision 250021)
+++ bb-reorder.c	(working copy)
@@ -957,7 +957,14 @@ better_edge_p (const_basic_block bb, con
     return !cur_best_edge
 	   || cur_best_edge->dest->index > e->dest->index;
 
-  if (prob > best_prob + diff_prob || !best_prob.initialized_p ())
+  /* Those edges are so expensive that continuing a trace is not useful
+     performance wise.  */
+  if (e->flags & (EDGE_ABNORMAL | EDGE_EH))
+    return false;
+
+  if (prob > best_prob + diff_prob
+      || (!best_prob.initialized_p ()
+	  && prob > profile_probability::guessed_never ()))
     /* The edge has higher probability than the temporary best edge.  */
     is_better_edge = true;
   else if (prob < best_prob - diff_prob)



More information about the Gcc-patches mailing list