Fix typos in inliner benefit analysis

Jan Hubicka hubicka@ucw.cz
Wed Sep 21 23:03:00 GMT 2011


Hi,
this patch fixes two rather embarassing typos that together caused that benefits
are pretty much ignored by the inliner heuristics.
Also to make benefits go right for large function I remived caping logic
in do_estimate_edge_time.  It is no longer needed since we no longe propagate
the values.

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

Honza
	* ipa-inline.c (relative_time_benefit): Fix wrong bracketting.
	* ipa-inline.h (estimate_edge_time): Fix pasto.
	* ipa-inline-analysis.c (do_estiamte_edge_time): Remove capping.
Index: ipa-inline.c
===================================================================
--- ipa-inline.c	(revision 179003)
+++ ipa-inline.c	(working copy)
@@ -710,9 +710,8 @@ relative_time_benefit (struct inline_sum
   uninlined_call_time =
     ((gcov_type)
      (callee_info->time
-      + inline_edge_summary (edge)->call_stmt_time
-      + CGRAPH_FREQ_BASE / 2) * edge->frequency
-     / CGRAPH_FREQ_BASE);
+      + inline_edge_summary (edge)->call_stmt_time) * edge->frequency
+     + CGRAPH_FREQ_BASE / 2) / CGRAPH_FREQ_BASE;
   /* Compute relative time benefit, i.e. how much the call becomes faster.
      ??? perhaps computing how much the caller+calle together become faster
      would lead to more realistic results.  */
Index: ipa-inline.h
===================================================================
--- ipa-inline.h	(revision 179003)
+++ ipa-inline.h	(working copy)
@@ -219,7 +219,7 @@ estimate_edge_time (struct cgraph_edge *
   if ((int)VEC_length (edge_growth_cache_entry, edge_growth_cache) <= edge->uid
       || !(ret = VEC_index (edge_growth_cache_entry,
 			    edge_growth_cache,
-			    edge->uid)->size))
+			    edge->uid)->time))
     return do_estimate_edge_time (edge);
   return ret - (ret > 0);
 }
Index: ipa-inline-analysis.c
===================================================================
--- ipa-inline-analysis.c	(revision 179046)
+++ ipa-inline-analysis.c	(working copy)
@@ -2164,10 +2201,9 @@ do_estimate_edge_time (struct cgraph_edg
 			       evaluate_conditions_for_edge (edge, true),
 			       &size, &time);
 
-  ret = (((gcov_type)time - es->call_stmt_time) * edge->frequency
+  ret = (((gcov_type)time
+	   - es->call_stmt_time) * edge->frequency
 	 + CGRAPH_FREQ_BASE / 2) / CGRAPH_FREQ_BASE;
-  if (ret > MAX_TIME)
-    ret = MAX_TIME;
 
   /* When caching, update the cache entry.  */
   if (edge_growth_cache)



More information about the Gcc-patches mailing list