diff options
author | Martin Jambor <mjambor@suse.cz> | 2011-07-26 14:26:58 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2011-07-26 14:26:58 +0200 |
commit | 5bf3d50db7d56329bb773c1ff87e30296e65cb87 (patch) | |
tree | f7aeaf09ac7ea815eff0a6aa785f1f2074639a55 | |
parent | 536e3f497eb8cbde60a6456edeaf1c13ed268763 (diff) | |
download | gcc-5bf3d50db7d56329bb773c1ff87e30296e65cb87.zip gcc-5bf3d50db7d56329bb773c1ff87e30296e65cb87.tar.gz gcc-5bf3d50db7d56329bb773c1ff87e30296e65cb87.tar.bz2 |
re PR bootstrap/49786 (bootstrap failed with bootstrap-profiled)
2011-07-26 Martin Jambor <mjambor@suse.cz>
PR bootstrap/49786
* ipa-cp.c (update_profiling_info): Avoid overflow when updating
counts.
(update_specialized_profile): Likewise.
From-SVN: r176789
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ipa-cp.c | 10 |
2 files changed, 13 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 913e202..7825a25 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2011-07-26 Martin Jambor <mjambor@suse.cz> + + PR bootstrap/49786 + * ipa-cp.c (update_profiling_info): Avoid overflow when updating + counts. + (update_specialized_profile): Likewise. + 2011-07-26 Uros Bizjak <ubizjak@gmail.com> H.J. Lu <hongjiu.lu@intel.com> diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index dc8cf09..94118b7 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -1877,7 +1877,6 @@ dump_profile_updates (struct cgraph_node *orig_node, cgraph_node_name (cs->callee), (HOST_WIDE_INT) cs->count); } - /* After a specialized NEW_NODE version of ORIG_NODE has been created, update their profile information to reflect this. */ @@ -1923,12 +1922,14 @@ update_profiling_info (struct cgraph_node *orig_node, for (cs = new_node->callees; cs ; cs = cs->next_callee) if (cs->frequency) - cs->count = cs->count * new_sum / orig_node_count; + cs->count = cs->count * (new_sum * REG_BR_PROB_BASE + / orig_node_count) / REG_BR_PROB_BASE; else cs->count = 0; for (cs = orig_node->callees; cs ; cs = cs->next_callee) - cs->count = cs->count * remainder / orig_node_count; + cs->count = cs->count * (remainder * REG_BR_PROB_BASE + / orig_node_count) / REG_BR_PROB_BASE; if (dump_file) dump_profile_updates (orig_node, new_node); @@ -1966,7 +1967,8 @@ update_specialized_profile (struct cgraph_node *new_node, for (cs = orig_node->callees; cs ; cs = cs->next_callee) { - gcov_type dec = cs->count * redirected_sum / orig_node_count; + gcov_type dec = cs->count * (redirected_sum * REG_BR_PROB_BASE + / orig_node_count) / REG_BR_PROB_BASE; if (dec < cs->count) cs->count -= dec; else |