From: Jan Hubicka Date: Sun, 2 Jul 2017 22:25:59 +0000 (+0200) Subject: dumpfile.c: Include profile-count.h X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0de11d4dd3d06ea7a77e172290b5f9f138f3fec2;p=gcc.git dumpfile.c: Include profile-count.h * dumpfile.c: Include profile-count.h * tree-cfg.c (gimple_duplicate_sese_tail): Drop UNUSED attributes; update profile. (insert_cond_bb): Update profile. * tree-cfg.h (insert_cond_bb): Update prototype. * tree-chkp-opt.c (chkp_optimize_string_function_calls): Update. * tree-dump.c: Do not include tree-cfg. From-SVN: r249887 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7e0cf647244..73e569551b7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2017-07-02 Jan Hubicka + + * dumpfile.c: Include profile-count.h + * tree-cfg.c (gimple_duplicate_sese_tail): Drop UNUSED attributes; update + profile. + (insert_cond_bb): Update profile. + * tree-cfg.h (insert_cond_bb): Update prototype. + * tree-chkp-opt.c (chkp_optimize_string_function_calls): Update. + * tree-dump.c: Do not include tree-cfg. + 2017-07-02 Jan Hubicka * bb-reorder.c (fix_up_crossing_landing_pad): Update profile. diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c index c3dd1268400..658500b6103 100644 --- a/gcc/dumpfile.c +++ b/gcc/dumpfile.c @@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see #include "diagnostic-core.h" #include "dumpfile.h" #include "context.h" +#include "profile-count.h" #include "tree-cfg.h" #include "langhooks.h" diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 24b06b91bbb..6add0402080 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -6390,9 +6390,9 @@ bb_part_of_region_p (basic_block bb, basic_block* bbs, unsigned n_region) */ bool -gimple_duplicate_sese_tail (edge entry ATTRIBUTE_UNUSED, edge exit ATTRIBUTE_UNUSED, - basic_block *region ATTRIBUTE_UNUSED, unsigned n_region ATTRIBUTE_UNUSED, - basic_block *region_copy ATTRIBUTE_UNUSED) +gimple_duplicate_sese_tail (edge entry, edge exit, + basic_block *region, unsigned n_region, + basic_block *region_copy) { unsigned i; bool free_region_copy = false; @@ -6502,7 +6502,12 @@ gimple_duplicate_sese_tail (edge entry ATTRIBUTE_UNUSED, edge exit ATTRIBUTE_UNU sorig = single_succ_edge (switch_bb); sorig->flags = exits[1]->flags; + sorig->probability = exits[1]->probability; + sorig->count = exits[1]->count; snew = make_edge (switch_bb, nentry_bb, exits[0]->flags); + snew->probability = exits[0]->probability; + snew->count = exits[1]->count; + /* Register the new edge from SWITCH_BB in loop exit lists. */ rescan_loop_exit (snew, true, false); @@ -8704,9 +8709,11 @@ make_pass_split_crit_edges (gcc::context *ctxt) /* Insert COND expression which is GIMPLE_COND after STMT in basic block BB with appropriate basic block split and creation of a new conditionally executed basic block. + Update profile so the new bb is visited with probability PROB. Return created basic block. */ basic_block -insert_cond_bb (basic_block bb, gimple *stmt, gimple *cond) +insert_cond_bb (basic_block bb, gimple *stmt, gimple *cond, + profile_probability prob) { edge fall = split_block (bb, stmt); gimple_stmt_iterator iter = gsi_last_bb (bb); @@ -8721,11 +8728,17 @@ insert_cond_bb (basic_block bb, gimple *stmt, gimple *cond) /* Create conditionally executed block. */ new_bb = create_empty_bb (bb); - make_edge (bb, new_bb, EDGE_TRUE_VALUE); + edge e = make_edge (bb, new_bb, EDGE_TRUE_VALUE); + e->probability = prob; + e->count = bb->count.apply_probability (prob); + new_bb->count = e->count; + new_bb->frequency = prob.apply (bb->frequency); make_single_succ_edge (new_bb, fall->dest, EDGE_FALLTHRU); /* Fix edge for split bb. */ fall->flags = EDGE_FALSE_VALUE; + fall->count -= e->count; + fall->probability -= e->probability; /* Update dominance info. */ if (dom_info_available_p (CDI_DOMINATORS)) diff --git a/gcc/tree-cfg.h b/gcc/tree-cfg.h index 4e1b5b076d5..66be43657bc 100644 --- a/gcc/tree-cfg.h +++ b/gcc/tree-cfg.h @@ -104,7 +104,8 @@ extern tree gimplify_build1 (gimple_stmt_iterator *, enum tree_code, extern void extract_true_false_edges_from_block (basic_block, edge *, edge *); extern unsigned int execute_fixup_cfg (void); extern unsigned int split_critical_edges (void); -extern basic_block insert_cond_bb (basic_block, gimple *, gimple *); +extern basic_block insert_cond_bb (basic_block, gimple *, gimple *, + profile_probability); extern bool gimple_find_sub_bbs (gimple_seq, gimple_stmt_iterator *); extern bool extract_true_false_controlled_edges (basic_block, basic_block, edge *, edge *); diff --git a/gcc/tree-chkp-opt.c b/gcc/tree-chkp-opt.c index a08f0819435..33f2a1bfcf5 100644 --- a/gcc/tree-chkp-opt.c +++ b/gcc/tree-chkp-opt.c @@ -1052,7 +1052,8 @@ chkp_optimize_string_function_calls (void) /* Split block before string function call. */ gsi_prev (&i); - check_bb = insert_cond_bb (bb, gsi_stmt (i), check); + check_bb = insert_cond_bb (bb, gsi_stmt (i), check, + profile_probability::likely ()); /* Set position for checks. */ j = gsi_last_bb (check_bb); diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c index 347b33ab505..0eab7ac590a 100644 --- a/gcc/tree-dump.c +++ b/gcc/tree-dump.c @@ -26,7 +26,6 @@ along with GCC; see the file COPYING3. If not see #include "tree-dump.h" #include "langhooks.h" #include "tree-iterator.h" -#include "tree-cfg.h" static unsigned int queue (dump_info_p, const_tree, int); static void dump_index (dump_info_p, unsigned int);