From: Jan Hubicka Date: Tue, 19 Apr 2011 14:23:38 +0000 (+0200) Subject: cgraph.h (cgraph_optimize_for_size_p): Declare. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e6416b305e7c6d1e6d4b1f92bc5875f3c8f4e729;p=gcc.git cgraph.h (cgraph_optimize_for_size_p): Declare. * cgraph.h (cgraph_optimize_for_size_p): Declare. * ipa-cp.c (ipcp_insert_stage): Use cgraph_optimize_for_size_p. * predict.c (cgraph_optimize_for_size_p): Break out from ... (optimize_function_for_size_p) ... here. From-SVN: r172711 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 14ed70733ca..efad7e54f36 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2011-04-19 Jan Hubicka + + * cgraph.h (cgraph_optimize_for_size_p): Declare. + * ipa-cp.c (ipcp_insert_stage): Use cgraph_optimize_for_size_p. + * predict.c (cgraph_optimize_for_size_p): Break out from ... + (optimize_function_for_size_p) ... here. + 2011-04-19 Richard Guenther PR lto/48207 diff --git a/gcc/cgraph.h b/gcc/cgraph.h index e3a3b58d4ff..a9c58798f57 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -656,6 +656,7 @@ bool cgraph_comdat_can_be_unshared_p (struct cgraph_node *); /* In predict.c */ bool cgraph_maybe_hot_edge_p (struct cgraph_edge *e); +bool cgraph_optimize_for_size_p (struct cgraph_node *); /* In varpool.c */ extern GTY(()) struct varpool_node *varpool_nodes_queue; diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index d8de9b7d9e8..0c057113614 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -1410,7 +1410,7 @@ ipcp_insert_stage (void) if (new_size + growth > max_new_size) break; if (growth - && optimize_function_for_size_p (DECL_STRUCT_FUNCTION (node->decl))) + && cgraph_optimize_for_size_p (node)) { if (dump_file) fprintf (dump_file, "Not versioning, cold code would grow"); diff --git a/gcc/predict.c b/gcc/predict.c index f210428fca1..db9c5c5a8fe 100644 --- a/gcc/predict.c +++ b/gcc/predict.c @@ -196,7 +196,9 @@ maybe_hot_edge_p (edge e) return maybe_hot_frequency_p (EDGE_FREQUENCY (e)); } + /* Return true in case BB is probably never executed. */ + bool probably_never_executed_bb_p (const_basic_block bb) { @@ -209,24 +211,31 @@ probably_never_executed_bb_p (const_basic_block bb) return false; } -/* Return true when current function should always be optimized for size. */ +/* Return true if NODE should be optimized for size. */ bool -optimize_function_for_size_p (struct function *fun) +cgraph_optimize_for_size_p (struct cgraph_node *node) { - struct cgraph_node *node; - if (optimize_size) return true; - if (!fun || !fun->decl) - return false; - node = cgraph_get_node (fun->decl); if (node && (node->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED)) return true; else return false; } +/* Return true when current function should always be optimized for size. */ + +bool +optimize_function_for_size_p (struct function *fun) +{ + if (optimize_size) + return true; + if (!fun || !fun->decl) + return false; + return cgraph_optimize_for_size_p (cgraph_get_node (fun->decl)); +} + /* Return true when current function should always be optimized for speed. */ bool