Print indirect call changes in afdo dump file
Print some information about indirect call promotions in the afdo dump file. Do it in the same format as the instrumented profiler so that the test suite can match on it. gcc/: 2016-07-13 Andi Kleen <ak@linux.intel.com> * auto-profile.c (update_inlined_ind_target, afdo_indirect_call): Print information to dump file. From-SVN: r238320
This commit is contained in:
parent
9f01da8e20
commit
0ea221ef24
@ -1,3 +1,8 @@
|
|||||||
|
2016-07-13 Andi Kleen <ak@linux.intel.com>
|
||||||
|
|
||||||
|
* auto-profile.c (update_inlined_ind_target,
|
||||||
|
afdo_indirect_call): Print information to dump file.
|
||||||
|
|
||||||
2016-07-13 Andrew Burgess <andrew.burgess@embecosm.com>
|
2016-07-13 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||||
|
|
||||||
* genrecog.c (special_predicate_operand_p): New function.
|
* genrecog.c (special_predicate_operand_p): New function.
|
||||||
|
@ -47,6 +47,8 @@ along with GCC; see the file COPYING3. If not see
|
|||||||
#include "ipa-inline.h"
|
#include "ipa-inline.h"
|
||||||
#include "tree-inline.h"
|
#include "tree-inline.h"
|
||||||
#include "auto-profile.h"
|
#include "auto-profile.h"
|
||||||
|
#include "tree-pretty-print.h"
|
||||||
|
#include "gimple-pretty-print.h"
|
||||||
|
|
||||||
/* The following routines implements AutoFDO optimization.
|
/* The following routines implements AutoFDO optimization.
|
||||||
|
|
||||||
@ -747,8 +749,18 @@ bool
|
|||||||
autofdo_source_profile::update_inlined_ind_target (gcall *stmt,
|
autofdo_source_profile::update_inlined_ind_target (gcall *stmt,
|
||||||
count_info *info)
|
count_info *info)
|
||||||
{
|
{
|
||||||
|
if (dump_file)
|
||||||
|
{
|
||||||
|
fprintf (dump_file, "Checking indirect call -> direct call ");
|
||||||
|
print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
|
||||||
|
}
|
||||||
|
|
||||||
if (LOCATION_LOCUS (gimple_location (stmt)) == cfun->function_end_locus)
|
if (LOCATION_LOCUS (gimple_location (stmt)) == cfun->function_end_locus)
|
||||||
|
{
|
||||||
|
if (dump_file)
|
||||||
|
fprintf (dump_file, " good locus\n");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
count_info old_info;
|
count_info old_info;
|
||||||
get_count_info (stmt, &old_info);
|
get_count_info (stmt, &old_info);
|
||||||
@ -765,21 +777,41 @@ autofdo_source_profile::update_inlined_ind_target (gcall *stmt,
|
|||||||
than half of the callsite count (stored in INFO), the original promoted
|
than half of the callsite count (stored in INFO), the original promoted
|
||||||
target is considered not hot any more. */
|
target is considered not hot any more. */
|
||||||
if (total >= info->count / 2)
|
if (total >= info->count / 2)
|
||||||
|
{
|
||||||
|
if (dump_file)
|
||||||
|
fprintf (dump_file, " not hot anymore %ld >= %ld",
|
||||||
|
(long)total,
|
||||||
|
(long)info->count /2);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
inline_stack stack;
|
inline_stack stack;
|
||||||
get_inline_stack (gimple_location (stmt), &stack);
|
get_inline_stack (gimple_location (stmt), &stack);
|
||||||
if (stack.length () == 0)
|
if (stack.length () == 0)
|
||||||
|
{
|
||||||
|
if (dump_file)
|
||||||
|
fprintf (dump_file, " no inline stack\n");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
function_instance *s = get_function_instance_by_inline_stack (stack);
|
function_instance *s = get_function_instance_by_inline_stack (stack);
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
|
{
|
||||||
|
if (dump_file)
|
||||||
|
fprintf (dump_file, " function not found in inline stack\n");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
icall_target_map map;
|
icall_target_map map;
|
||||||
if (s->find_icall_target_map (stmt, &map) == 0)
|
if (s->find_icall_target_map (stmt, &map) == 0)
|
||||||
|
{
|
||||||
|
if (dump_file)
|
||||||
|
fprintf (dump_file, " no target map\n");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
for (icall_target_map::const_iterator iter = map.begin ();
|
for (icall_target_map::const_iterator iter = map.begin ();
|
||||||
iter != map.end (); ++iter)
|
iter != map.end (); ++iter)
|
||||||
info->targets[iter->first] = iter->second;
|
info->targets[iter->first] = iter->second;
|
||||||
|
if (dump_file)
|
||||||
|
fprintf (dump_file, " looks good\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -997,10 +1029,34 @@ afdo_indirect_call (gimple_stmt_iterator *gsi, const icall_target_map &map,
|
|||||||
struct cgraph_node *direct_call = cgraph_node::get_for_asmname (
|
struct cgraph_node *direct_call = cgraph_node::get_for_asmname (
|
||||||
get_identifier ((const char *) hist->hvalue.counters[0]));
|
get_identifier ((const char *) hist->hvalue.counters[0]));
|
||||||
|
|
||||||
|
if (dump_file)
|
||||||
|
{
|
||||||
|
fprintf (dump_file, "Indirect call -> direct call ");
|
||||||
|
print_generic_expr (dump_file, callee, TDF_SLIM);
|
||||||
|
fprintf (dump_file, " => ");
|
||||||
|
print_generic_expr (dump_file, direct_call->decl, TDF_SLIM);
|
||||||
|
}
|
||||||
|
|
||||||
if (direct_call == NULL || !check_ic_target (stmt, direct_call))
|
if (direct_call == NULL || !check_ic_target (stmt, direct_call))
|
||||||
|
{
|
||||||
|
if (dump_file)
|
||||||
|
fprintf (dump_file, " not transforming\n");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
if (DECL_STRUCT_FUNCTION (direct_call->decl) == NULL)
|
if (DECL_STRUCT_FUNCTION (direct_call->decl) == NULL)
|
||||||
|
{
|
||||||
|
if (dump_file)
|
||||||
|
fprintf (dump_file, " no declaration\n");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dump_file)
|
||||||
|
{
|
||||||
|
fprintf (dump_file, " transformation on insn ");
|
||||||
|
print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
|
||||||
|
fprintf (dump_file, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
struct cgraph_edge *new_edge
|
struct cgraph_edge *new_edge
|
||||||
= indirect_edge->make_speculative (direct_call, 0, 0);
|
= indirect_edge->make_speculative (direct_call, 0, 0);
|
||||||
new_edge->redirect_call_stmt_to_callee ();
|
new_edge->redirect_call_stmt_to_callee ();
|
||||||
|
Loading…
Reference in New Issue
Block a user