aboutsummaryrefslogtreecommitdiff
path: root/gcc/predict.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2013-09-09 09:37:53 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2013-09-09 07:37:53 +0000
commitdaf5c7705fe749beef4971a4cbaff770f784d4d6 (patch)
treebf09a0700a2bcf2fd44b45cba67aa2fbf69d9130 /gcc/predict.c
parenta12cd2db29add721d2124b5cafa1dd44128dd554 (diff)
downloadgcc-daf5c7705fe749beef4971a4cbaff770f784d4d6.zip
gcc-daf5c7705fe749beef4971a4cbaff770f784d4d6.tar.gz
gcc-daf5c7705fe749beef4971a4cbaff770f784d4d6.tar.bz2
ipa-profile.c: Add toplevel comment.
* ipa-profile.c: Add toplevel comment. (ipa_propagate_frequency_1): Be more conservative when profile is read. (contains_hot_call_p): New function. (ipa_propagate_frequency): Set frequencies based on counts when profile is read. * predict.c (compute_function_frequency): Use PROFILE_READ gueard for profile; do not tamper with profile after inlining if it is read. From-SVN: r202382
Diffstat (limited to 'gcc/predict.c')
-rw-r--r--gcc/predict.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/predict.c b/gcc/predict.c
index ddf72d2..affed79 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -2871,13 +2871,14 @@ compute_function_frequency (void)
{
basic_block bb;
struct cgraph_node *node = cgraph_get_node (current_function_decl);
+
if (DECL_STATIC_CONSTRUCTOR (current_function_decl)
|| MAIN_NAME_P (DECL_NAME (current_function_decl)))
node->only_called_at_startup = true;
if (DECL_STATIC_DESTRUCTOR (current_function_decl))
node->only_called_at_exit = true;
- if (!profile_info || !flag_branch_probabilities)
+ if (profile_status != PROFILE_READ)
{
int flags = flags_from_decl_or_type (current_function_decl);
if (lookup_attribute ("cold", DECL_ATTRIBUTES (current_function_decl))
@@ -2895,7 +2896,13 @@ compute_function_frequency (void)
node->frequency = NODE_FREQUENCY_EXECUTED_ONCE;
return;
}
- node->frequency = NODE_FREQUENCY_UNLIKELY_EXECUTED;
+
+ /* Only first time try to drop function into unlikely executed.
+ After inlining the roundoff errors may confuse us.
+ Ipa-profile pass will drop functions only called from unlikely
+ functions to unlikely and that is most of what we care about. */
+ if (!cfun->after_inlining)
+ node->frequency = NODE_FREQUENCY_UNLIKELY_EXECUTED;
FOR_EACH_BB (bb)
{
if (maybe_hot_bb_p (cfun, bb))