+2017-07-02 Jan Hubicka <hubicka@ucw.cz>
+
+ * 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 <hubicka@ucw.cz>
* bb-reorder.c (fix_up_crossing_landing_pad): Update profile.
*/
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;
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);
/* 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);
/* 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))
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 *);