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]

Re: [PATCH] Fix PR48186


On Thu, Apr 04, 2013 at 04:06:35PM +0200, Jakub Jelinek wrote:
> In this second hunk the division is done only for flag_guess_branch_prob,
> so shouldn't it be
>   if (flag_guess_branch_prob)
>     {
>       if (PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION) == 0
> 	  || edge->frequency <= (CGRAPH_FREQ_BASE
> 				 / PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION)))
> 	return false;
>     }
>   return true;
> instead?

Yeah, I guess so.  Thanks; fixed:

2013-04-04  Marek Polacek  <polacek@redhat.com>

	PR tree-optimization/48186
	* predict.c (maybe_hot_frequency_p): Return false if
	HOT_BB_FREQUENCY_FRACTION is 0.
	(cgraph_maybe_hot_edge_p): Likewise.

	* gcc.dg/pr48186.c: New test.

--- gcc/predict.c.mp	2013-04-04 16:16:16.396977123 +0200
+++ gcc/predict.c	2013-04-04 16:16:21.857994025 +0200
@@ -122,6 +122,8 @@ maybe_hot_frequency_p (struct function *
   if (node->frequency == NODE_FREQUENCY_EXECUTED_ONCE
       && freq < (ENTRY_BLOCK_PTR_FOR_FUNCTION (fun)->frequency * 2 / 3))
     return false;
+  if (PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION) == 0)
+    return false;
   if (freq < (ENTRY_BLOCK_PTR_FOR_FUNCTION (fun)->frequency
 	      / PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION)))
     return false;
@@ -203,9 +205,12 @@ cgraph_maybe_hot_edge_p (struct cgraph_e
       && edge->frequency < CGRAPH_FREQ_BASE * 3 / 2)
     return false;
   if (flag_guess_branch_prob
-      && edge->frequency <= (CGRAPH_FREQ_BASE
-      			     / PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION)))
-    return false;
+    {
+      if (PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION) == 0
+	  || edge->frequency <= (CGRAPH_FREQ_BASE
+				 / PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION)))
+        return false;
+    }
   return true;
 }
 
--- gcc/testsuite/gcc.dg/pr48186.c.mp	2013-04-04 16:18:01.978310788 +0200
+++ gcc/testsuite/gcc.dg/pr48186.c	2013-04-04 16:12:25.510243745 +0200
@@ -0,0 +1,5 @@
+/* PR tree-optimization/48186 */
+/* { dg-do compile } */
+/* { dg-options "-O --param hot-bb-frequency-fraction=0" } */
+
+void foo (void) { }

	Marek


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