aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index b79f9e8..7c3507c 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -862,7 +862,7 @@ symbol_table::create_edge (cgraph_node *caller, cgraph_node *callee,
edge->next_callee = NULL;
edge->lto_stmt_uid = 0;
- edge->count = count;
+ edge->count = count.ipa ();
edge->frequency = freq;
gcc_checking_assert (freq >= 0);
gcc_checking_assert (freq <= CGRAPH_FREQ_MAX);
@@ -1308,7 +1308,7 @@ cgraph_edge::redirect_call_stmt_to_callee (void)
/* We are producing the final function body and will throw away the
callgraph edges really soon. Reset the counts/frequencies to
keep verifier happy in the case of roundoff errors. */
- e->count = gimple_bb (e->call_stmt)->count;
+ e->count = gimple_bb (e->call_stmt)->count.ipa ();
e->frequency = compute_call_stmt_bb_frequency
(e->caller->decl, gimple_bb (e->call_stmt));
}
@@ -1338,7 +1338,7 @@ cgraph_edge::redirect_call_stmt_to_callee (void)
prob = profile_probability::even ();
new_stmt = gimple_ic (e->call_stmt,
dyn_cast<cgraph_node *> (ref->referred),
- prob, e->count, e->count + e2->count);
+ prob);
e->speculative = false;
e->caller->set_call_stmt_including_clones (e->call_stmt, new_stmt,
false);
@@ -1644,7 +1644,7 @@ cgraph_update_edges_for_call_stmt_node (cgraph_node *node,
/* Otherwise remove edge and create new one; we can't simply redirect
since function has changed, so inline plan and other information
attached to edge is invalid. */
- count = e->count;
+ count = e->count.ipa ();
frequency = e->frequency;
if (e->indirect_unknown_callee || e->inline_failed)
e->remove ();
@@ -1655,7 +1655,7 @@ cgraph_update_edges_for_call_stmt_node (cgraph_node *node,
{
/* We are seeing new direct call; compute profile info based on BB. */
basic_block bb = gimple_bb (new_stmt);
- count = bb->count;
+ count = bb->count.ipa ();
frequency = compute_call_stmt_bb_frequency (current_function_decl,
bb);
}
@@ -3082,9 +3082,14 @@ bool
cgraph_edge::verify_count_and_frequency ()
{
bool error_found = false;
- if (count < 0)
+ if (!count.verify ())
{
- error ("caller edge count is negative");
+ error ("caller edge count invalid");
+ error_found = true;
+ }
+ if (count.initialized_p () && !(count.ipa () == count))
+ {
+ error ("caller edge count is local");
error_found = true;
}
if (frequency < 0)
@@ -3183,9 +3188,14 @@ cgraph_node::verify_node (void)
identifier_to_locale (e->callee->name ()));
error_found = true;
}
- if (count < 0)
+ if (!count.verify ())
+ {
+ error ("cgraph count invalid");
+ error_found = true;
+ }
+ if (count.initialized_p () && !(count.ipa () == count))
{
- error ("execution count is negative");
+ error ("cgraph count is local");
error_found = true;
}
if (global.inlined_to && same_comdat_group)
@@ -3269,7 +3279,9 @@ cgraph_node::verify_node (void)
{
if (e->verify_count_and_frequency ())
error_found = true;
+ /* FIXME: re-enable once cgraph is converted to counts. */
if (gimple_has_body_p (e->caller->decl)
+ && 0
&& !e->caller->global.inlined_to
&& !e->speculative
/* Optimized out calls are redirected to __builtin_unreachable. */
@@ -3292,9 +3304,11 @@ cgraph_node::verify_node (void)
{
if (e->verify_count_and_frequency ())
error_found = true;
+ /* FIXME: re-enable once cgraph is converted to counts. */
if (gimple_has_body_p (e->caller->decl)
&& !e->caller->global.inlined_to
&& !e->speculative
+ && 0
&& (e->frequency
!= compute_call_stmt_bb_frequency (e->caller->decl,
gimple_bb (e->call_stmt))))