aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2017-07-03 00:25:59 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2017-07-02 22:25:59 +0000
commit0de11d4dd3d06ea7a77e172290b5f9f138f3fec2 (patch)
tree50b66a0553a1ce676d3f569083f9ae07678c7798 /gcc
parentd872853dce396c9848142145507043040be14c5c (diff)
downloadgcc-0de11d4dd3d06ea7a77e172290b5f9f138f3fec2.zip
gcc-0de11d4dd3d06ea7a77e172290b5f9f138f3fec2.tar.gz
gcc-0de11d4dd3d06ea7a77e172290b5f9f138f3fec2.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/dumpfile.c1
-rw-r--r--gcc/tree-cfg.c23
-rw-r--r--gcc/tree-cfg.h3
-rw-r--r--gcc/tree-chkp-opt.c3
-rw-r--r--gcc/tree-dump.c1
6 files changed, 33 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7e0cf64..73e5695 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,15 @@
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.
2017-07-02 Jan Hubicka <hubicka@ucw.cz>
diff --git a/gcc/dumpfile.c b/gcc/dumpfile.c
index c3dd126..658500b 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 24b06b9..6add040 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 4e1b5b0..66be436 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 a08f081..33f2a1b 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 347b33a..0eab7ac 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);