[prev in list] [next in list] [prev in thread] [next in thread]
List: gcc-patches
Subject: Cleanup maybe_hot predicates
From: Jan Hubicka <jh () suse ! cz>
Date: 2008-08-31 12:52:36
Message-ID: 20080831125236.GA17462 () kam ! mff ! cuni ! cz
[Download RAW message or body]
Hi,
bootstrapped/regtested i686-linux and comitted.
Honza
* 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.
Index: postreload-gcse.c
===================================================================
*** postreload-gcse.c (revision 139826)
--- postreload-gcse.c (working copy)
*************** eliminate_partially_redundant_loads (voi
*** 1173,1179 ****
continue;
/* Do not try anything on cold basic blocks. */
! if (probably_cold_bb_p (bb))
continue;
/* Reset the table of things changed since the start of the current
--- 1173,1179 ----
continue;
/* Do not try anything on cold basic blocks. */
! if (optimize_bb_for_size_p (bb))
continue;
/* Reset the table of things changed since the start of the current
Index: predict.c
===================================================================
*** predict.c (revision 139827)
--- predict.c (working copy)
*************** static const struct predictor_info predi
*** 110,116 ****
#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)
--- 110,117 ----
#undef DEF_PREDICTOR
/* Return TRUE if frequency FREQ is considered to be hot. */
!
! static inline bool
maybe_hot_frequency_p (int freq)
{
if (!profile_info || !flag_branch_probabilities)
*************** maybe_hot_frequency_p (int freq)
*** 127,143 ****
return true;
}
/* 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 true if the call can be hot. */
--- 128,154 ----
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)
{
! return maybe_hot_count_p (bb->count) || maybe_hot_frequency_p (bb->frequency);
}
/* Return true if the call can be hot. */
*************** cgraph_maybe_hot_edge_p (struct cgraph_e
*** 167,194 ****
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 true in case BB is probably never executed. */
--- 178,184 ----
bool
maybe_hot_edge_p (edge e)
{
! return maybe_hot_count_p (e->count) || maybe_hot_frequency_p (EDGE_FREQUENCY (e));
}
/* Return true in case BB is probably never executed. */
Index: basic-block.h
===================================================================
*** basic-block.h (revision 139826)
--- basic-block.h (working copy)
*************** extern void compute_available (sbitmap *
*** 829,835 ****
/* 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);
--- 829,834 ----
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic