diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2017-10-07 18:48:34 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2017-10-07 16:48:34 +0000 |
commit | 12b9f3ac928e1ed7e3aa92cab42beb6317b27981 (patch) | |
tree | 52d0be8478f0b04ec8cab8d8483d08112708c62e /gcc/predict.c | |
parent | 59e2f25ee754cc258b55fac759afd6d47d8879d8 (diff) | |
download | gcc-12b9f3ac928e1ed7e3aa92cab42beb6317b27981.zip gcc-12b9f3ac928e1ed7e3aa92cab42beb6317b27981.tar.gz gcc-12b9f3ac928e1ed7e3aa92cab42beb6317b27981.tar.bz2 |
invoke.texi (Wsuggest-attribute=cold): Document.
* invoke.texi (Wsuggest-attribute=cold): Document.
* common.opt (Wsuggest-attribute=cold): New
* ipa-pure-const.c (warn_function_cold): New function.
* predict.c (compute_function_frequency): Use it.
* predict.h (warn_function_cold): Declare.
* gcc.dg/cold-1.c: New testcase.
From-SVN: r253513
Diffstat (limited to 'gcc/predict.c')
-rw-r--r-- | gcc/predict.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/predict.c b/gcc/predict.c index 80c2c19..e534502 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -3613,7 +3613,10 @@ compute_function_frequency (void) if (ENTRY_BLOCK_PTR_FOR_FN (cfun)->count == profile_count::zero () || lookup_attribute ("cold", DECL_ATTRIBUTES (current_function_decl)) != NULL) - node->frequency = NODE_FREQUENCY_UNLIKELY_EXECUTED; + { + node->frequency = NODE_FREQUENCY_UNLIKELY_EXECUTED; + warn_function_cold (current_function_decl); + } else if (lookup_attribute ("hot", DECL_ATTRIBUTES (current_function_decl)) != NULL) node->frequency = NODE_FREQUENCY_HOT; @@ -3632,7 +3635,10 @@ compute_function_frequency (void) 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; + { + node->frequency = NODE_FREQUENCY_UNLIKELY_EXECUTED; + warn_function_cold (current_function_decl); + } FOR_EACH_BB_FN (bb, cfun) { if (maybe_hot_bb_p (cfun, bb)) |