aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfg.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2017-10-19 22:19:15 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2017-10-19 20:19:15 +0000
commitef30ab837c42b9555b3fc290454a5c02cb65487a (patch)
tree4369c2bc5c320d42e366fed603000b529e1d32b8 /gcc/cfg.c
parent68581ee1c343fb52065f6ff39ea0d84175b12a66 (diff)
downloadgcc-ef30ab837c42b9555b3fc290454a5c02cb65487a.zip
gcc-ef30ab837c42b9555b3fc290454a5c02cb65487a.tar.gz
gcc-ef30ab837c42b9555b3fc290454a5c02cb65487a.tar.bz2
asan.c (create_cond_insert_point): Do not update edge count.
* asan.c (create_cond_insert_point): Do not update edge count. * auto-profile.c (afdo_propagate_edge): Update for edge count removal. (afdo_propagate_circuit): Likewise. (afdo_calculate_branch_prob): Likewise. (afdo_annotate_cfg): Likewise. * basic-block.h (struct edge_def): Remove count. (edge_def::count): New accessor. * bb-reorder.c (rotate_loop): Update. (find_traces_1_round): Update. (connect_traces): Update. (sanitize_hot_paths): Update. * cfg.c (unchecked_make_edge): Update. (make_single_succ_edge): Update. (check_bb_profile): Update. (dump_edge_info): Update. (update_bb_profile_for_threading): Update. (scale_bbs_frequencies_int): Update. (scale_bbs_frequencies_gcov_type): Update. (scale_bbs_frequencies_profile_count): Update. (scale_bbs_frequencies): Update. * cfganal.c (connect_infinite_loops_to_exit): Update. * cfgbuild.c (compute_outgoing_frequencies): Update. (find_many_sub_basic_blocks): Update. * cfgcleanup.c (try_forward_edges): Update. (try_crossjump_to_edge): Update * cfgexpand.c (expand_gimple_cond): Update (expand_gimple_tailcall): Update (construct_exit_block): Update * cfghooks.c (verify_flow_info): Update (redirect_edge_succ_nodup): Update (split_edge): Update (make_forwarder_block): Update (duplicate_block): Update (account_profile_record): Update * cfgloop.c (find_subloop_latch_edge_by_profile): Update. * cfgloopanal.c (expected_loop_iterations_unbounded): Update. * cfgloopmanip.c (scale_loop_profile): Update. (loopify): Update. (lv_adjust_loop_entry_edge): Update. * cfgrtl.c (try_redirect_by_replacing_jump): Update. (force_nonfallthru_and_redirect): Update. (purge_dead_edges): Update. (rtl_flow_call_edges_add): Update. * cgraphunit.c (init_lowered_empty_function): Update. (cgraph_node::expand_thunk): Update. * gimple-pretty-print.c (dump_probability): Update. (dump_edge_probability): Update. * gimple-ssa-isolate-paths.c (isolate_path): Update. * haifa-sched.c (sched_create_recovery_edges): Update. * hsa-gen.c (convert_switch_statements): Update. * ifcvt.c (dead_or_predicable): Update. * ipa-inline-transform.c (inline_transform): Update. * ipa-split.c (split_function): Update. * ipa-utils.c (ipa_merge_profiles): Update. * loop-doloop.c (add_test): Update. * loop-unroll.c (unroll_loop_runtime_iterations): Update. * lto-streamer-in.c (input_cfg): Update. (input_function): Update. * lto-streamer-out.c (output_cfg): Update. * modulo-sched.c (sms_schedule): Update. * postreload-gcse.c (eliminate_partially_redundant_load): Update. * predict.c (maybe_hot_edge_p): Update. (unlikely_executed_edge_p): Update. (probably_never_executed_edge_p): Update. (dump_prediction): Update. (drop_profile): Update. (propagate_unlikely_bbs_forward): Update. (determine_unlikely_bbs): Update. (force_edge_cold): Update. * profile.c (compute_branch_probabilities): Update. * reg-stack.c (better_edge): Update. * shrink-wrap.c (handle_simple_exit): Update. * tracer.c (better_p): Update. * trans-mem.c (expand_transaction): Update. (split_bb_make_tm_edge): Update. * tree-call-cdce.c: Update. * tree-cfg.c (gimple_find_sub_bbs): Update. (gimple_split_edge): Update. (gimple_duplicate_sese_region): Update. (gimple_duplicate_sese_tail): Update. (gimple_flow_call_edges_add): Update. (insert_cond_bb): Update. (execute_fixup_cfg): Update. * tree-cfgcleanup.c (cleanup_control_expr_graph): Update. * tree-complex.c (expand_complex_div_wide): Update. * tree-eh.c (lower_resx): Update. (unsplit_eh): Update. (cleanup_empty_eh_move_lp): Update. * tree-inline.c (copy_edges_for_bb): Update. (freqs_to_counts): Update. (copy_cfg_body): Update. * tree-ssa-dce.c (remove_dead_stmt): Update. * tree-ssa-ifcombine.c (update_profile_after_ifcombine): Update. * tree-ssa-loop-im.c (execute_sm_if_changed): Update. * tree-ssa-loop-ivcanon.c (remove_exits_and_undefined_stmts): Update. (unloop_loops): Update. * tree-ssa-loop-manip.c (tree_transform_and_unroll_loop): Update. * tree-ssa-loop-split.c (connect_loops): Update. (split_loop): Update. * tree-ssa-loop-unswitch.c (hoist_guard): Update. * tree-ssa-phionlycprop.c (propagate_rhs_into_lhs): Update. * tree-ssa-phiopt.c (replace_phi_edge_with_variable): Update. * tree-ssa-reassoc.c (branch_fixup): Update. * tree-ssa-tail-merge.c (replace_block_by): Update. * tree-ssa-threadupdate.c (remove_ctrl_stmt_and_useless_edges): Update. (compute_path_counts): Update. (update_profile): Update. (recompute_probabilities): Update. (update_joiner_offpath_counts): Update. (estimated_freqs_path): Update. (freqs_to_counts_path): Update. (clear_counts_path): Update. (ssa_fix_duplicate_block_edges): Update. (duplicate_thread_path): Update. * tree-switch-conversion.c (hoist_edge_and_branch_if_true): Update. (case_bit_test_cmp): Update. (collect_switch_conv_info): Update. (gen_inbound_check): Update. (do_jump_if_equal): Update. (emit_cmp_and_jump_insns): Update. * tree-tailcall.c (decrease_profile): Update. (eliminate_tail_call): Update. * tree-vect-loop-manip.c (slpeel_add_loop_guard): Update. (vect_do_peeling): Update. * tree-vect-loop.c (scale_profile_for_vect_loop): Update. * ubsan.c (ubsan_expand_null_ifn): Update. (ubsan_expand_ptr_ifn): Update. * value-prof.c (gimple_divmod_fixed_value): Update. (gimple_mod_pow2): Update. (gimple_mod_subtract): Update. (gimple_ic): Update. (gimple_stringop_fixed_value): Update. From-SVN: r253910
Diffstat (limited to 'gcc/cfg.c')
-rw-r--r--gcc/cfg.c56
1 files changed, 2 insertions, 54 deletions
diff --git a/gcc/cfg.c b/gcc/cfg.c
index 01e68ae..41002ec 100644
--- a/gcc/cfg.c
+++ b/gcc/cfg.c
@@ -263,7 +263,6 @@ unchecked_make_edge (basic_block src, basic_block dst, int flags)
e = ggc_cleared_alloc<edge_def> ();
n_edges_for_fn (cfun)++;
- e->count = profile_count::uninitialized ();
e->probability = profile_probability::uninitialized ();
e->src = src;
e->dest = dst;
@@ -334,7 +333,6 @@ make_single_succ_edge (basic_block src, basic_block dest, int flags)
edge e = make_edge (src, dest, flags);
e->probability = profile_probability::always ();
- e->count = src->count;
return e;
}
@@ -445,18 +443,6 @@ check_bb_profile (basic_block bb, FILE * file, int indent)
";; %sInvalid sum of outgoing probabilities %.1f%%\n",
s_indent, isum * 100.0 / REG_BR_PROB_BASE);
}
- profile_count lsum = profile_count::zero ();
- FOR_EACH_EDGE (e, ei, bb->succs)
- lsum += e->count;
- if (EDGE_COUNT (bb->succs) && lsum.differs_from_p (bb->count))
- {
- fprintf (file, ";; %sInvalid sum of outgoing counts ",
- s_indent);
- lsum.dump (file);
- fprintf (file, ", should be ");
- bb->count.dump (file);
- fprintf (file, "\n");
- }
}
}
if (bb != ENTRY_BLOCK_PTR_FOR_FN (fun))
@@ -468,18 +454,6 @@ check_bb_profile (basic_block bb, FILE * file, int indent)
fprintf (file,
";; %sInvalid sum of incoming frequencies %i, should be %i\n",
s_indent, sum, bb->frequency);
- profile_count lsum = profile_count::zero ();
- FOR_EACH_EDGE (e, ei, bb->preds)
- lsum += e->count;
- if (lsum.differs_from_p (bb->count))
- {
- fprintf (file, ";; %sInvalid sum of incoming counts ",
- s_indent);
- lsum.dump (file);
- fprintf (file, ", should be ");
- bb->count.dump (file);
- fprintf (file, "\n");
- }
}
if (BB_PARTITION (bb) == BB_COLD_PARTITION)
{
@@ -522,10 +496,10 @@ dump_edge_info (FILE *file, edge e, dump_flags_t flags, int do_succ)
fprintf (file, "] ");
}
- if (e->count.initialized_p () && do_details)
+ if (e->count ().initialized_p () && do_details)
{
fputs (" count:", file);
- e->count.dump (file);
+ e->count ().dump (file);
}
if (e->flags && do_details)
@@ -941,10 +915,6 @@ update_bb_profile_for_threading (basic_block bb, int edge_frequency,
}
gcc_assert (bb == taken_edge->src);
- if (dump_file && taken_edge->count < count)
- fprintf (dump_file, "edge %i->%i count became negative after threading",
- taken_edge->src->index, taken_edge->dest->index);
- taken_edge->count -= count;
}
/* Multiply all frequencies of basic blocks in array BBS of length NBBS
@@ -953,7 +923,6 @@ void
scale_bbs_frequencies_int (basic_block *bbs, int nbbs, int num, int den)
{
int i;
- edge e;
if (num < 0)
num = 0;
@@ -973,14 +942,11 @@ scale_bbs_frequencies_int (basic_block *bbs, int nbbs, int num, int den)
for (i = 0; i < nbbs; i++)
{
- edge_iterator ei;
bbs[i]->frequency = RDIV (bbs[i]->frequency * num, den);
/* Make sure the frequencies do not grow over BB_FREQ_MAX. */
if (bbs[i]->frequency > BB_FREQ_MAX)
bbs[i]->frequency = BB_FREQ_MAX;
bbs[i]->count = bbs[i]->count.apply_scale (num, den);
- FOR_EACH_EDGE (e, ei, bbs[i]->succs)
- e->count = e->count.apply_scale (num, den);
}
}
@@ -996,7 +962,6 @@ scale_bbs_frequencies_gcov_type (basic_block *bbs, int nbbs, gcov_type num,
gcov_type den)
{
int i;
- edge e;
gcov_type fraction = RDIV (num * 65536, den);
gcc_assert (fraction >= 0);
@@ -1004,29 +969,20 @@ scale_bbs_frequencies_gcov_type (basic_block *bbs, int nbbs, gcov_type num,
if (num < MAX_SAFE_MULTIPLIER)
for (i = 0; i < nbbs; i++)
{
- edge_iterator ei;
bbs[i]->frequency = RDIV (bbs[i]->frequency * num, den);
if (bbs[i]->count <= MAX_SAFE_MULTIPLIER)
bbs[i]->count = bbs[i]->count.apply_scale (num, den);
else
bbs[i]->count = bbs[i]->count.apply_scale (fraction, 65536);
- FOR_EACH_EDGE (e, ei, bbs[i]->succs)
- if (bbs[i]->count <= MAX_SAFE_MULTIPLIER)
- e->count = e->count.apply_scale (num, den);
- else
- e->count = e->count.apply_scale (fraction, 65536);
}
else
for (i = 0; i < nbbs; i++)
{
- edge_iterator ei;
if (sizeof (gcov_type) > sizeof (int))
bbs[i]->frequency = RDIV (bbs[i]->frequency * num, den);
else
bbs[i]->frequency = RDIV (bbs[i]->frequency * fraction, 65536);
bbs[i]->count = bbs[i]->count.apply_scale (fraction, 65536);
- FOR_EACH_EDGE (e, ei, bbs[i]->succs)
- e->count = e->count.apply_scale (fraction, 65536);
}
}
@@ -1038,16 +994,12 @@ scale_bbs_frequencies_profile_count (basic_block *bbs, int nbbs,
profile_count num, profile_count den)
{
int i;
- edge e;
for (i = 0; i < nbbs; i++)
{
- edge_iterator ei;
bbs[i]->frequency = RDIV (bbs[i]->frequency * num.to_gcov_type (),
den.to_gcov_type ());
bbs[i]->count = bbs[i]->count.apply_scale (num, den);
- FOR_EACH_EDGE (e, ei, bbs[i]->succs)
- e->count = e->count.apply_scale (num, den);
}
}
@@ -1059,15 +1011,11 @@ scale_bbs_frequencies (basic_block *bbs, int nbbs,
profile_probability p)
{
int i;
- edge e;
for (i = 0; i < nbbs; i++)
{
- edge_iterator ei;
bbs[i]->frequency = p.apply (bbs[i]->frequency);
bbs[i]->count = bbs[i]->count.apply_probability (p);
- FOR_EACH_EDGE (e, ei, bbs[i]->succs)
- e->count = e->count.apply_probability (p);
}
}