diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2015-01-12 10:24:18 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2015-01-12 09:24:18 +0000 |
commit | d8d5aef10080e5c96414ba48fa31e41e823a95f7 (patch) | |
tree | 993913a7158e643f48bf7e882b92891566a2049e /gcc/ipa-prop.c | |
parent | 0d2dd460fe627cf460536b80b99f56682775fe78 (diff) | |
download | gcc-d8d5aef10080e5c96414ba48fa31e41e823a95f7.zip gcc-d8d5aef10080e5c96414ba48fa31e41e823a95f7.tar.gz gcc-d8d5aef10080e5c96414ba48fa31e41e823a95f7.tar.bz2 |
re PR ipa/63470 (internal compiler error: in estimate_edge_growth, at ipa-inline.h:308)
PR ipa/63470
* ipa-inline-analysis.c (inline_edge_duplication_hook): Adjust
cost when edge becomes direct.
* ipa-prop.c (make_edge_direct): Do not adjust when speculation
is resolved or when introducing new speculation.
* testsuite/g++.dg/ipa/pr63470.C: New testcase.
From-SVN: r219451
Diffstat (limited to 'gcc/ipa-prop.c')
-rw-r--r-- | gcc/ipa-prop.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index a96b2be..01f4111 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -2737,7 +2737,20 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target, ie->caller->name (), callee->name ()); } if (!speculative) - ie = ie->make_direct (callee); + { + struct cgraph_edge *orig = ie; + ie = ie->make_direct (callee); + /* If we resolved speculative edge the cost is already up to date + for direct call (adjusted by inline_edge_duplication_hook). */ + if (ie == orig) + { + es = inline_edge_summary (ie); + es->call_stmt_size -= (eni_size_weights.indirect_call_cost + - eni_size_weights.call_cost); + es->call_stmt_time -= (eni_time_weights.indirect_call_cost + - eni_time_weights.call_cost); + } + } else { if (!callee->can_be_discarded_p ()) @@ -2747,14 +2760,10 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target, if (alias) callee = alias; } + /* make_speculative will update ie's cost to direct call cost. */ ie = ie->make_speculative (callee, ie->count * 8 / 10, ie->frequency * 8 / 10); } - es = inline_edge_summary (ie); - es->call_stmt_size -= (eni_size_weights.indirect_call_cost - - eni_size_weights.call_cost); - es->call_stmt_time -= (eni_time_weights.indirect_call_cost - - eni_time_weights.call_cost); return ie; } |