Patchwork Fix PR48186

login
register
mail settings
Submitter Marek Polacek
Date April 4, 2013, 2:20 p.m.
Message ID <20130404142036.GE24873@redhat.com>
Download mbox | patch
Permalink /patch/233842/
State New
Headers show

Comments

Marek Polacek - April 4, 2013, 2:20 p.m.
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.


	Marek

Patch

--- 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) { }