summaryrefslogtreecommitdiff
path: root/gcc/ipa-pure-const.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-01 21:55:49 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-01 21:55:49 +0000
commite093314183374e29dac0d4a73c296deb782c18f8 (patch)
tree9b44105d588d9c7a44fc7884f12ec8614194f420 /gcc/ipa-pure-const.c
parenteef62d057d326243a3511f9d32fd5c3a2bc1e889 (diff)
downloadgcc-e093314183374e29dac0d4a73c296deb782c18f8.tar.gz
* ipa-pure-const.c (local_pure_const): Do NORETURN discovery.
* testsuite/gcc.dg/noreturn-8.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160124 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-pure-const.c')
-rw-r--r--gcc/ipa-pure-const.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index df2f8c85312..d785389191a 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -1362,6 +1362,27 @@ local_pure_const (void)
&& !warn_suggest_attribute_pure
&& skip)
return 0;
+
+ /* First do NORETURN discovery. */
+ if (!skip && !TREE_THIS_VOLATILE (current_function_decl)
+ && EDGE_COUNT (EXIT_BLOCK_PTR->preds) == 0)
+ {
+ if (warn_missing_noreturn
+ && !lang_hooks.missing_noreturn_ok_p (cfun->decl))
+ warning_at (DECL_SOURCE_LOCATION (cfun->decl), OPT_Wmissing_noreturn,
+ "function might be possible candidate "
+ "for attribute %<noreturn%>");
+ if (dump_file)
+ fprintf (dump_file, "Function found to be noreturn: %s\n",
+ lang_hooks.decl_printable_name (current_function_decl, 2));
+
+ /* Update declaration and reduce profile to executed once. */
+ TREE_THIS_VOLATILE (current_function_decl) = 1;
+ if (node->frequency > NODE_FREQUENCY_EXECUTED_ONCE)
+ node->frequency = NODE_FREQUENCY_EXECUTED_ONCE;
+
+ changed = true;
+ }
l = analyze_function (node, false);
switch (l->pure_const_state)