aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-ssa-isolate-paths.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2017-09-01 15:02:37 +0200
committerMartin Liska <marxin@gcc.gnu.org>2017-09-01 13:02:37 +0000
commit002618d87483cfb6481b0a044f113c9cf87d4ed6 (patch)
tree1b23eb613e74a81e3afccc8d0276e8b176b0ee71 /gcc/gimple-ssa-isolate-paths.c
parenta2de90a45a9193cb19a5837110698fe59d6deb41 (diff)
downloadgcc-002618d87483cfb6481b0a044f113c9cf87d4ed6.zip
gcc-002618d87483cfb6481b0a044f113c9cf87d4ed6.tar.gz
gcc-002618d87483cfb6481b0a044f113c9cf87d4ed6.tar.bz2
Fix profile update in tree-ssa-isolate-paths.c (PR tree-optimization/82059).
2017-09-01 Martin Liska <mliska@suse.cz> PR tree-optimization/82059 * gimple-ssa-isolate-paths.c (isolate_path): Add profile and frequency only when an edge is redirected. 2017-09-01 Martin Liska <mliska@suse.cz> PR tree-optimization/82059 * gcc.dg/tree-ssa/pr82059.c: New test. From-SVN: r251591
Diffstat (limited to 'gcc/gimple-ssa-isolate-paths.c')
-rw-r--r--gcc/gimple-ssa-isolate-paths.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/gimple-ssa-isolate-paths.c b/gcc/gimple-ssa-isolate-paths.c
index fbc41057..807e003 100644
--- a/gcc/gimple-ssa-isolate-paths.c
+++ b/gcc/gimple-ssa-isolate-paths.c
@@ -160,14 +160,17 @@ isolate_path (basic_block bb, basic_block duplicate,
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);
if (e2)
- flush_pending_stmts (e2);
+ {
+ flush_pending_stmts (e2);
+ /* Update profile only when redirection is really processed. */
+ bb->frequency += EDGE_FREQUENCY (e);
+ bb->count += e->count;
+ }
/* There may be more than one statement in DUPLICATE which exhibits
undefined behavior. Ultimately we want the first such statement in