aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2017-07-03 14:43:19 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2017-07-03 12:43:19 +0000
commite1a921ddaac5e50426fc2b0edfee3b17a4607fe6 (patch)
treed5bd12280a7ef21113e8ce213f93a2c99175592e
parentb5db8b44e55b6d95865c59e92779dc7dc2e3c273 (diff)
downloadgcc-e1a921ddaac5e50426fc2b0edfee3b17a4607fe6.zip
gcc-e1a921ddaac5e50426fc2b0edfee3b17a4607fe6.tar.gz
gcc-e1a921ddaac5e50426fc2b0edfee3b17a4607fe6.tar.bz2
* tree-cfg.c (gimple_find_sub_bbs): Fix profile updating.
From-SVN: r249908
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/tree-cfg.c11
2 files changed, 12 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3d0826a..dd4c44b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2017-07-02 Jan Hubicka <hubicka@ucw.cz>
+ * tree-cfg.c (gimple_find_sub_bbs): Fix profile updating.
+
+2017-07-02 Jan Hubicka <hubicka@ucw.cz>
+
* tree-cfgcleanup.c (want_merge_blocks_p): New function.
(cleanup_tree_cfg_bb): Use it.
* profile-count.h (profile_count::of_for_merging, profile_count::merge):
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index e0cee12..2483731 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -1051,6 +1051,7 @@ gimple_find_sub_bbs (gimple_seq seq, gimple_stmt_iterator *gsi)
struct omp_region *cur_region = NULL;
profile_count cnt = profile_count::zero ();
int freq = 0;
+ bool all = true;
int cur_omp_region_idx = 0;
int mer = make_edges_bb (bb, &cur_region, &cur_omp_region_idx);
@@ -1061,12 +1062,16 @@ gimple_find_sub_bbs (gimple_seq seq, gimple_stmt_iterator *gsi)
edge_iterator ei;
FOR_EACH_EDGE (e, ei, bb->preds)
{
- cnt += e->count;
+ if (e->count.initialized_p ())
+ cnt += e->count;
+ else
+ all = false;
freq += EDGE_FREQUENCY (e);
}
- bb->count = cnt;
- bb->frequency = freq;
tree_guess_outgoing_edge_probabilities (bb);
+ if (all || profile_status_for_fn (cfun) == PROFILE_READ)
+ bb->count = cnt;
+ bb->frequency = freq;
FOR_EACH_EDGE (e, ei, bb->succs)
e->count = bb->count.apply_probability (e->probability);