aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2017-06-16 21:02:46 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2017-06-16 19:02:46 +0000
commitaa11163b181893ed79dc1c75547b0109b342372e (patch)
tree22146ca895c35eae24514389bea670f0509f1c89 /gcc
parent8d71d7cd025d5b0b62a8cb9fd99c38f1b37fcc7d (diff)
downloadgcc-aa11163b181893ed79dc1c75547b0109b342372e.zip
gcc-aa11163b181893ed79dc1c75547b0109b342372e.tar.gz
gcc-aa11163b181893ed79dc1c75547b0109b342372e.tar.bz2
gimple-ssa-isolate-paths.c (isolate_path): Set edge leading to path as unlikely; update profile.
* gimple-ssa-isolate-paths.c (isolate_path): Set edge leading to path as unlikely; update profile. From-SVN: r249277
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/gimple-ssa-isolate-paths.c13
2 files changed, 18 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b22b567..dfabe17 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2017-06-16 Jan Hubicka <hubicka@ucw.cz>
+ * gimple-ssa-isolate-paths.c (isolate_path): Set edge leading to path
+ as unlikely; update profile.
+
+2017-06-16 Jan Hubicka <hubicka@ucw.cz>
+
* predict.c (force_edge_cold): Handle declaring edges impossible
more aggresively.
diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c
index 7babe09..7ad39b4 100644
--- a/gcc/gimple-ssa-isolate-paths.c
+++ b/gcc/gimple-ssa-isolate-paths.c
@@ -137,6 +137,15 @@ isolate_path (basic_block bb, basic_block duplicate,
gimple_stmt_iterator si, si2;
edge_iterator ei;
edge e2;
+ bool impossible = true;
+
+ for (si = gsi_start_bb (bb); gsi_stmt (si) != stmt; gsi_next (&si))
+ if (stmt_can_terminate_bb_p (gsi_stmt (si)))
+ {
+ impossible = false;
+ break;
+ }
+ force_edge_cold (e, impossible);
/* First duplicate BB if we have not done so already and remove all
the duplicate's outgoing edges as duplicate is going to unconditionally
@@ -145,10 +154,14 @@ isolate_path (basic_block bb, basic_block duplicate,
if (!duplicate)
{
duplicate = duplicate_block (bb, NULL, NULL);
+ bb->frequency = 0;
+ bb->count = profile_count::zero ();
if (!ret_zero)
for (ei = ei_start (duplicate->succs); (e2 = ei_safe_edge (ei)); )
remove_edge (e2);
}
+ bb->frequency += EDGE_FREQUENCY (e);
+ bb->count += e->count;
/* Complete the isolation step by redirecting E to reach DUPLICATE. */
e2 = redirect_edge_and_branch (e, duplicate);