]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
postreload-gcse.c (eliminate_partially_redundant_loads): Use optimize_bb_for_size_p.
authorJan Hubicka <jh@suse.cz>
Sun, 31 Aug 2008 12:52:07 +0000 (14:52 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sun, 31 Aug 2008 12:52:07 +0000 (12:52 +0000)
* postreload-gcse.c (eliminate_partially_redundant_loads): Use optimize_bb_for_size_p.
* predict.c (maybe_hot_frequency_p): Make inline.
(maybe_hot_count_p): Break out from ...
(maybe_hot_bb_p): ... this one.
(maybe_hot_edge_p): Simplify.
* basic-block.h (probably_cold_bb_p): Remove.

From-SVN: r139830

gcc/ChangeLog
gcc/basic-block.h
gcc/postreload-gcse.c
gcc/predict.c

index c5690fcd8e42eb91c1a4b86bb63bc49f53c650a0..b20e8b23769fbe37366c1f28e9d84187df9f1b34 100644 (file)
@@ -1,3 +1,12 @@
+2008-08-31  Jan Hubicka  <jh@suse.cz>
+
+       * postreload-gcse.c (eliminate_partially_redundant_loads): Use optimize_bb_for_size_p.
+       * predict.c (maybe_hot_frequency_p): Make inline.
+       (maybe_hot_count_p): Break out from ...
+       (maybe_hot_bb_p): ... this one.
+       (maybe_hot_edge_p): Simplify.
+       * basic-block.h (probably_cold_bb_p): Remove.
+
 2008-08-31  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/37168
index 59a6f4aca9cba6687a4fbd70215e253f2c83607d..9b759b001478b596d7b6696702bb83fe7b5a7b35 100644 (file)
@@ -829,7 +829,6 @@ 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 optimize_bb_for_size_p (const_basic_block);
 extern bool optimize_bb_for_speed_p (const_basic_block);
index 884830abebd2c1c912e13ca7757abf2bda202635..57be7a5c39c5efed4fc22431a5c633a73f02defe 100644 (file)
@@ -1173,7 +1173,7 @@ eliminate_partially_redundant_loads (void)
        continue;
 
       /* Do not try anything on cold basic blocks.  */
-      if (probably_cold_bb_p (bb))
+      if (optimize_bb_for_size_p (bb))
        continue;
 
       /* Reset the table of things changed since the start of the current
index e02f9f890c2fd417bbe94f3c29d37627a5bed436..183ae8fa7cb6ad64b04df55ba0a3d01e4247d8a8 100644 (file)
@@ -110,7 +110,8 @@ static const struct predictor_info predictor_info[]= {
 #undef DEF_PREDICTOR
 
 /* Return TRUE if frequency FREQ is considered to be hot.  */
-static bool
+
+static inline bool
 maybe_hot_frequency_p (int freq)
 {
   if (!profile_info || !flag_branch_probabilities)
@@ -127,17 +128,27 @@ maybe_hot_frequency_p (int freq)
   return true;
 }
 
+/* Return TRUE if frequency FREQ is considered to be hot.  */
+
+static inline bool
+maybe_hot_count_p (gcov_type count)
+{
+  if (profile_status != PROFILE_READ)
+    return true;
+  /* Code executed at most once is not hot.  */
+  if (profile_info->runs >= count)
+    return false;
+  return (count
+         > profile_info->sum_max / PARAM_VALUE (HOT_BB_COUNT_FRACTION));
+}
+
 /* Return true in case BB can be CPU intensive and should be optimized
    for maximal performance.  */
 
 bool
 maybe_hot_bb_p (const_basic_block bb)
 {
-  if (profile_info && flag_branch_probabilities
-      && (bb->count
-         < profile_info->sum_max / PARAM_VALUE (HOT_BB_COUNT_FRACTION)))
-    return false;
-  return maybe_hot_frequency_p (bb->frequency);
+  return maybe_hot_count_p (bb->count) || maybe_hot_frequency_p (bb->frequency);
 }
 
 /* Return true if the call can be hot.  */
@@ -167,28 +178,7 @@ cgraph_maybe_hot_edge_p (struct cgraph_edge *edge)
 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 maybe_hot_frequency_p (EDGE_FREQUENCY (e));
-}
-
-/* Return true in case BB is cold and should be optimized for size.  */
-
-bool
-probably_cold_bb_p (const_basic_block bb)
-{
-  if (profile_info && flag_branch_probabilities
-      && (bb->count
-         < profile_info->sum_max / PARAM_VALUE (HOT_BB_COUNT_FRACTION)))
-    return true;
-  if ((!profile_info || !flag_branch_probabilities)
-      && cfun->function_frequency == FUNCTION_FREQUENCY_UNLIKELY_EXECUTED)
-    return true;
-  if (bb->frequency < BB_FREQ_MAX / PARAM_VALUE (HOT_BB_FREQUENCY_FRACTION))
-    return true;
-  return false;
+  return maybe_hot_count_p (e->count) || maybe_hot_frequency_p (EDGE_FREQUENCY (e));
 }
 
 /* Return true in case BB is probably never executed.  */