diff options
author | Jan Hubicka <jh@suse.cz> | 2012-10-25 14:23:08 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2012-10-25 12:23:08 +0000 |
commit | 6ced940d172f65be316637f4945fbf633a79ab90 (patch) | |
tree | 91eceb61ba434564a9cddbd2a5c553eea6e3c4d3 /gcc | |
parent | 43a8f1a1c3fdd9b629d0495a44b417012d756f99 (diff) | |
download | gcc-6ced940d172f65be316637f4945fbf633a79ab90.zip gcc-6ced940d172f65be316637f4945fbf633a79ab90.tar.gz gcc-6ced940d172f65be316637f4945fbf633a79ab90.tar.bz2 |
ipa-inline.c (recursive_inlining): Redirect to master clone before testing profitability.
* ipa-inline.c (recursive_inlining): Redirect to master
clone before testing profitability.
From-SVN: r192807
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ipa-inline.c | 31 |
2 files changed, 30 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 59c476f..0b86552 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2012-10-25 Jan Hubicka <jh@suse.cz> + + * ipa-inline.c (recursive_inlining): Redirect to master + clone before testing profitability. + 2012-10-25 Richard Biener <rguenther@suse.de> PR tree-optimization/54902 diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index f5c255c..3f9a800 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -1190,14 +1190,28 @@ recursive_inlining (struct cgraph_edge *edge, { struct cgraph_edge *curr = (struct cgraph_edge *) fibheap_extract_min (heap); - struct cgraph_node *cnode; - - if (estimate_size_after_inlining (node, curr) > limit) - break; + struct cgraph_node *cnode, *dest = curr->callee; if (!can_inline_edge_p (curr, true)) continue; + /* MASTER_CLONE is produced in the case we already started modified + the function. Be sure to redirect edge to the original body before + estimating growths otherwise we will be seeing growths after inlining + the already modified body. */ + if (master_clone) + { + cgraph_redirect_edge_callee (curr, master_clone); + reset_edge_growth_cache (curr); + } + + if (estimate_size_after_inlining (node, curr) > limit) + { + cgraph_redirect_edge_callee (curr, dest); + reset_edge_growth_cache (curr); + break; + } + depth = 1; for (cnode = curr->caller; cnode->global.inlined_to; cnode = cnode->callers->caller) @@ -1206,7 +1220,11 @@ recursive_inlining (struct cgraph_edge *edge, depth++; if (!want_inline_self_recursive_call_p (curr, node, false, depth)) - continue; + { + cgraph_redirect_edge_callee (curr, dest); + reset_edge_growth_cache (curr); + continue; + } if (dump_file) { @@ -1228,9 +1246,10 @@ recursive_inlining (struct cgraph_edge *edge, for (e = master_clone->callees; e; e = e->next_callee) if (!e->inline_failed) clone_inlined_nodes (e, true, false, NULL); + cgraph_redirect_edge_callee (curr, master_clone); + reset_edge_growth_cache (curr); } - cgraph_redirect_edge_callee (curr, master_clone); inline_call (curr, false, new_edges, &overall_size, true); lookup_recursive_calls (node, curr->callee, heap); n++; |