summaryrefslogtreecommitdiff
path: root/gcc/value-prof.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2013-08-13 12:21:16 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2013-08-13 12:21:16 +0000
commit12d5ae9f36940d21c2d3804a81678b6ebc941d80 (patch)
treee903dc537f27c5dd690cb3a98029321225e8f7b4 /gcc/value-prof.c
parent936c99ae35bdc3ab7e01faae57b9570cf0d18781 (diff)
downloadgcc-12d5ae9f36940d21c2d3804a81678b6ebc941d80.tar.gz
* cgraph.c (cgraph_turn_edge_to_speculative): Return newly
introduced edge; fix typo in sanity check. (cgraph_resolve_speculation): Export; improve diagnostic. (cgraph_redirect_edge_call_stmt_to_callee): Better diagnostic; cancel speculation at type mismatch. * cgraph.h (cgraph_turn_edge_to_speculative): Update. (cgraph_resolve_speculation): Declare. (symtab_can_be_discarded): New function. * value-prof.c (gimple_ic_transform): Remove actual transform code. * ipa-inline-transform.c (speculation_removed): New global var. (clone_inlined_nodes): See if speculation can be removed. (inline_call): If speculations was removed, we growths may not match. * ipa-inline.c (can_inline_edge_p): Add DISREGARD_LIMITS parameter. (speculation_useful_p): New function. (resolve_noninline_speculation): New function. (inline_small_functions): Resolve useless speculations. * ipa-inline.h (speculation_useful_p): Declare * ipa.c (can_replace_by_local_alias): Simplify. (ipa_profile): Produce speculative calls in non-lto, too; add simple cost model; produce local aliases. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@201683 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/value-prof.c')
-rw-r--r--gcc/value-prof.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/gcc/value-prof.c b/gcc/value-prof.c
index f110277f22d..8aa9fcda905 100644
--- a/gcc/value-prof.c
+++ b/gcc/value-prof.c
@@ -1431,8 +1431,6 @@ gimple_ic_transform (gimple_stmt_iterator *gsi)
gimple stmt = gsi_stmt (*gsi);
histogram_value histogram;
gcov_type val, count, all, bb_all;
- gcov_type prob;
- gimple modify;
struct cgraph_node *direct_call;
if (gimple_code (stmt) != GIMPLE_CALL)
@@ -1452,12 +1450,6 @@ gimple_ic_transform (gimple_stmt_iterator *gsi)
count = histogram->hvalue.counters [1];
all = histogram->hvalue.counters [2];
- if (4 * count <= 3 * all)
- {
- gimple_remove_histogram_value (cfun, stmt, histogram);
- return false;
- }
-
bb_all = gimple_bb (stmt)->count;
/* The order of CHECK_COUNTER calls is important -
since check_counter can correct the third parameter
@@ -1469,10 +1461,9 @@ gimple_ic_transform (gimple_stmt_iterator *gsi)
return false;
}
- if (all > 0)
- prob = GCOV_COMPUTE_SCALE (count, all);
- else
- prob = 0;
+ if (4 * count <= 3 * all)
+ return false;
+
direct_call = find_func_by_profile_id ((int)val);
if (direct_call == NULL)
@@ -1488,12 +1479,21 @@ gimple_ic_transform (gimple_stmt_iterator *gsi)
}
return false;
}
- gimple_remove_histogram_value (cfun, stmt, histogram);
if (!check_ic_target (stmt, direct_call))
- return false;
-
- modify = gimple_ic (stmt, direct_call, prob, count, all);
+ {
+ if (dump_file)
+ {
+ fprintf (dump_file, "Indirect call -> direct call ");
+ print_generic_expr (dump_file, gimple_call_fn (stmt), TDF_SLIM);
+ fprintf (dump_file, "=> ");
+ print_generic_expr (dump_file, direct_call->symbol.decl, TDF_SLIM);
+ fprintf (dump_file, " transformation skipped because of type mismatch");
+ print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
+ }
+ gimple_remove_histogram_value (cfun, stmt, histogram);
+ return false;
+ }
if (dump_file)
{
@@ -1501,10 +1501,8 @@ gimple_ic_transform (gimple_stmt_iterator *gsi)
print_generic_expr (dump_file, gimple_call_fn (stmt), TDF_SLIM);
fprintf (dump_file, "=> ");
print_generic_expr (dump_file, direct_call->symbol.decl, TDF_SLIM);
- fprintf (dump_file, " transformation on insn ");
+ fprintf (dump_file, " transformation on insn postponned to ipa-profile");
print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
- fprintf (dump_file, " to ");
- print_gimple_stmt (dump_file, modify, 0, TDF_SLIM);
fprintf (dump_file, "hist->count "HOST_WIDEST_INT_PRINT_DEC
" hist->all "HOST_WIDEST_INT_PRINT_DEC"\n", count, all);
}