predict.c (maybe_hot_frequency_p): Break out of...
authorJan Hubicka <jh@suse.cz>
Mon, 2 Jun 2008 16:36:49 +0000 (18:36 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 2 Jun 2008 16:36:49 +0000 (16:36 +0000)
* predict.c (maybe_hot_frequency_p): Break out of...
(maybe_hot_bb_p): ... here.
(maybe_hot_edge_p): New.
* tree-ssa-coalesce.c (coalesce_cost_edge): Compute cost based on edge.
* basic-block.h (maybe_hot_edge_p): Declare.

From-SVN: r136282

gcc/ChangeLog
gcc/basic-block.h
gcc/predict.c
gcc/tree-ssa-coalesce.c

index 0cc0223e2d813cda71f9b7ef9cb7083c7b1db0ee..d0235fac00eeaee710f7d8509a0808682e8ef2bd 100644 (file)
@@ -1,3 +1,11 @@
+2008-05-26  Jan Hubicka  <jh@suse.cz>
+
+       * predict.c (maybe_hot_frequency_p): Break out of...
+       (maybe_hot_bb_p): ... here.
+       (maybe_hot_edge_p): New.
+       * tree-ssa-coalesce.c (coalesce_cost_edge): Compute cost based on edge.
+       * basic-block.h (maybe_hot_edge_p): Declare.
+
 2008-05-31  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/i386.md (*cmpfp_<mode>): Enable for optimize_size.
index 53e8a8b5685d92b77f1ae641743d5214f0e8d124..17ec338a7a41a2adf459d78e149c0634beb88c4d 100644 (file)
@@ -827,6 +827,7 @@ extern void compute_available (sbitmap *, sbitmap *, sbitmap *, sbitmap *);
 
 /* In predict.c */
 extern bool maybe_hot_bb_p (const_basic_block);
+extern bool maybe_hot_edge_p (edge);
 extern bool probably_cold_bb_p (const_basic_block);
 extern bool probably_never_executed_bb_p (const_basic_block);
 extern bool tree_predicted_by_p (const_basic_block, enum br_predictor);
index 41743331b9e1d9432681efa440dcb302922699fa..42852dcfcacd5761f4e33a4d2eeafad640966e0a 100644 (file)
@@ -107,6 +107,22 @@ static const struct predictor_info predictor_info[]= {
 };
 #undef DEF_PREDICTOR
 
+/* Return TRUE if frequency FREQ is considered to be hot.  */
+static bool
+maybe_hot_frequency_p (int freq)
+{
+  if (!profile_info || !flag_branch_probabilities)
+    {
+      if (cfun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED)
+        return false;
+      if (cfun->function_frequency == FUNCTION_FREQUENCY_HOT)
+        return true;
+    }
+  if (freq < BB_FREQ_MAX / PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION))
+    return false;
+  return true;
+}
+
 /* Return true in case BB can be CPU intensive and should be optimized
    for maximal performance.  */
 
@@ -117,16 +133,20 @@ maybe_hot_bb_p (const_basic_block bb)
       && (bb->count
          < profile_info->sum_max / PARAM_VALUE (HOT_BB_COUNT_FRACTION)))
     return false;
-  if (!profile_info || !flag_branch_probabilities)
-    {
-      if (cfun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED)
-        return false;
-      if (cfun->function_frequency == FUNCTION_FREQUENCY_HOT)
-        return true;
-    }
-  if (bb->frequency < BB_FREQ_MAX / PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION))
+  return maybe_hot_frequency_p (bb->frequency);
+}
+
+/* Return true in case BB can be CPU intensive and should be optimized
+   for maximal performance.  */
+
+bool
+maybe_hot_edge_p (edge e)
+{
+  if (profile_info && flag_branch_probabilities
+      && (e->count
+         < profile_info->sum_max / PARAM_VALUE (HOT_BB_COUNT_FRACTION)))
     return false;
-  return true;
+  return maybe_hot_frequency_p (EDGE_FREQUENCY (e));
 }
 
 /* Return true in case BB is cold and should be optimized for size.  */
index ef1ebcab4a97142c124d619f7cd2f1c4b5a51c0e..172f1a2f829adc238074cb4f88dcaac11a5926a1 100644 (file)
@@ -114,7 +114,7 @@ coalesce_cost_edge (edge e)
     return MUST_COALESCE_COST;
 
   return coalesce_cost (EDGE_FREQUENCY (e), 
-                       maybe_hot_bb_p (e->src), 
+                       maybe_hot_edge_p (e), 
                        EDGE_CRITICAL_P (e));
 }