summaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-28 21:45:27 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2005-07-28 21:45:27 +0000
commit0aca0eb6a538d96f1c8bd25f289c4f5eea05573c (patch)
treea1f5a77fc57f6b24e2832b89c2a840ee9c6bb3f5 /gcc/cgraph.c
parent1e2f6f3248337c9e4de47646e9684ab4f16f7197 (diff)
downloadgcc-0aca0eb6a538d96f1c8bd25f289c4f5eea05573c.tar.gz
* cgraph.c (cgraph_clone_edge): New UPDATE_ORIGINAL argument.
(cgraph_clone_node): Likewise. * cgraph.h (cgraph_clone_edge): Update prototype. (cgraph_clone_node): Likewise. * ipa-inline.c (cgraph_clone_inlined_nodes): Update call of cgraph_clone_node. (lookup_recursive_calls): Consider profile. (cgraph_decide_recursive_inlining): Fix updating; use new probability argument; use profile. * params.def (PARAM_MIN_INLINE_RECURSIVE_PROBABILITY): New. * tree-inline.c (copy_bb): Update clal of clone_edge. * tree-optimize.c (tree_rest_of_compilation): UPdate cal of clone_node. * invoke.texi (min-inline-recursive-probability): Document. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102521 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index ffc8d25eb5f..7a67f6d0da8 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -884,7 +884,8 @@ cgraph_function_possibly_inlined_p (tree decl)
/* Create clone of E in the node N represented by CALL_EXPR the callgraph. */
struct cgraph_edge *
cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n,
- tree call_stmt, int count_scale, int loop_nest)
+ tree call_stmt, int count_scale, int loop_nest,
+ bool update_original)
{
struct cgraph_edge *new;
@@ -893,14 +894,20 @@ cgraph_clone_edge (struct cgraph_edge *e, struct cgraph_node *n,
e->loop_nest + loop_nest);
new->inline_failed = e->inline_failed;
- e->count -= new->count;
+ if (update_original)
+ e->count -= new->count;
return new;
}
/* Create node representing clone of N executed COUNT times. Decrease
- the execution counts from original node too. */
+ the execution counts from original node too.
+
+ When UPDATE_ORIGINAL is true, the counts are subtracted from the original
+ function's profile to reflect the fact that part of execution is handled
+ by node. */
struct cgraph_node *
-cgraph_clone_node (struct cgraph_node *n, gcov_type count, int loop_nest)
+cgraph_clone_node (struct cgraph_node *n, gcov_type count, int loop_nest,
+ bool update_original)
{
struct cgraph_node *new = cgraph_create_node ();
struct cgraph_edge *e;
@@ -923,10 +930,12 @@ cgraph_clone_node (struct cgraph_node *n, gcov_type count, int loop_nest)
count_scale = new->count * REG_BR_PROB_BASE / n->count;
else
count_scale = 0;
- n->count -= count;
+ if (update_original)
+ n->count -= count;
for (e = n->callees;e; e=e->next_callee)
- cgraph_clone_edge (e, new, e->call_stmt, count_scale, loop_nest);
+ cgraph_clone_edge (e, new, e->call_stmt, count_scale, loop_nest,
+ update_original);
new->next_clone = n->next_clone;
new->prev_clone = n;