}
result = gimple_divmod_fixed_value (stmt, tree_val, prob, count, all);
- if (dump_file)
- {
- fprintf (dump_file, "Transformation done: div/mod by constant ");
- print_generic_expr (dump_file, tree_val, TDF_SLIM);
- fprintf (dump_file, "\n");
- }
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, stmt,
+ "Transformation done: div/mod by constant %T\n", tree_val);
gimple_assign_set_rhs_from_tree (si, result);
update_stmt (gsi_stmt (*si));
if (check_counter (stmt, "pow2", &count, &all, gimple_bb (stmt)->count))
return false;
- if (dump_file)
- fprintf (dump_file, "Transformation done: mod power of 2\n");
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, stmt,
+ "Transformation done: mod power of 2\n");
if (all > 0)
prob = profile_probability::probability_in_gcov_type (count, all);
return false;
gimple_remove_histogram_value (cfun, stmt, histogram);
- if (dump_file)
- fprintf (dump_file, "Transformation done: mod subtract\n");
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, stmt,
+ "Transformation done: mod subtract\n");
/* Compute probability of taking the optimal path(s). */
if (all > 0)
if (n->has_gimple_body_p () || n->thunk.thunk_p)
{
cgraph_node **val;
+ dump_user_location_t loc
+ = dump_user_location_t::from_function_decl (n->decl);
if (local)
{
n->profile_id = coverage_compute_profile_id (n);
while ((val = cgraph_node_map->get (n->profile_id))
|| !n->profile_id)
{
- if (dump_file)
- fprintf (dump_file, "Local profile-id %i conflict"
- " with nodes %s %s\n",
- n->profile_id,
- n->dump_name (),
- (*val)->dump_name ());
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc,
+ "Local profile-id %i conflict"
+ " with nodes %s %s\n",
+ n->profile_id,
+ n->dump_name (),
+ (*val)->dump_name ());
n->profile_id = (n->profile_id + 1) & 0x7fffffff;
}
}
else if (!n->profile_id)
{
- if (dump_file)
- fprintf (dump_file,
- "Node %s has no profile-id"
- " (profile feedback missing?)\n",
- n->dump_name ());
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc,
+ "Node %s has no profile-id"
+ " (profile feedback missing?)\n",
+ n->dump_name ());
continue;
}
else if ((val = cgraph_node_map->get (n->profile_id)))
{
- if (dump_file)
- fprintf (dump_file,
- "Node %s has IP profile-id %i conflict. "
- "Giving up.\n",
- n->dump_name (), n->profile_id);
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, loc,
+ "Node %s has IP profile-id %i conflict. "
+ "Giving up.\n",
+ n->dump_name (), n->profile_id);
*val = NULL;
continue;
}
{
if (val)
{
- if (dump_file)
- {
- fprintf (dump_file, "Indirect call -> direct call from other module");
- print_generic_expr (dump_file, gimple_call_fn (stmt), TDF_SLIM);
- fprintf (dump_file, "=> %i (will resolve only with LTO)\n", (int)val);
- }
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, stmt,
+ "Indirect call -> direct call from other "
+ "module %T=> %i (will resolve only with LTO)",
+ gimple_call_fn (stmt), (int)val);
}
return false;
}
if (!check_ic_target (stmt, direct_call))
{
- 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->decl, TDF_SLIM);
- fprintf (dump_file, " transformation skipped because of type mismatch");
- print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
- }
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, stmt,
+ "Indirect call -> direct call %T => %T "
+ "transformation skipped because of type mismatch: %G",
+ gimple_call_fn (stmt), direct_call->decl, stmt);
gimple_remove_histogram_value (cfun, stmt, histogram);
return false;
}
- if (dump_file)
+ if (dump_enabled_p ())
{
- 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->decl, TDF_SLIM);
- fprintf (dump_file, " transformation on insn postponned to ipa-profile");
- print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM);
- fprintf (dump_file, "hist->count %" PRId64
- " hist->all %" PRId64"\n", count, all);
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, stmt,
+ "Indirect call -> direct call "
+ "%T => %T transformation on insn postponed "
+ "to ipa-profile: %G", gimple_call_fn (stmt),
+ direct_call->decl, stmt);
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, stmt,
+ "hist->count %" PRId64
+ " hist->all %" PRId64"\n", count, all);
}
return true;
TYPE_PRECISION (get_gcov_type ()), false));
}
- if (dump_file)
- fprintf (dump_file,
- "Transformation done: single value %i stringop for %s\n",
- (int)val, built_in_names[(int)fcode]);
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, stmt,
+ "Transformation done: single value %i stringop for %s\n",
+ (int)val, built_in_names[(int)fcode]);
gimple_stringop_fixed_value (stmt, tree_val, prob, count, all);