From 353f9f1628a39a4188175704565f242f2cc1c260 Mon Sep 17 00:00:00 2001 From: law Date: Mon, 30 Sep 2013 20:09:25 +0000 Subject: [PATCH] * tree-ssa-threadupdate.c (ssa_fix_duplicate_block_edges): Update redirected out edge count in joiner case. (ssa_redirect_edges): Common the joiner and non-joiner cases so that joiner case gets profile updates. * testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c (expand_one_var): Update for additional dump message. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203041 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c | 2 +- gcc/tree-ssa-threadupdate.c | 25 +++++++++++------------- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1d4720b014c..ee3e01e8f93 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-09-30 Teresa Johnson + + * tree-ssa-threadupdate.c (ssa_fix_duplicate_block_edges): + Update redirected out edge count in joiner case. + (ssa_redirect_edges): Common the joiner and non-joiner cases + so that joiner case gets profile updates. + 2013-09-30 Richard Biener PR tree-optimization/58554 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 75ac73a99de..98147745d81 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-09-30 Teresa Johnson + + * testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c (expand_one_var): + Update for additional dump message. + + 2013-09-30 Richard Biener PR tree-optimization/58554 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c index 222a97b4a12..0d53f501d84 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-thread-3.c @@ -42,7 +42,7 @@ expand_one_var (tree var, unsigned char toplevel, unsigned char really_expand) abort (); } /* We should thread the jump, through an intermediate block. */ -/* { dg-final { scan-tree-dump-times "Threaded" 1 "dom1"} } */ +/* { dg-final { scan-tree-dump-times "Threaded" 2 "dom1"} } */ /* { dg-final { scan-tree-dump-times "Registering jump thread: \\(.*\\) incoming edge; \\(.*\\) joiner; \\(.*\\) nocopy;" 1 "dom1"} } */ /* { dg-final { cleanup-tree-dump "dom1" } } */ diff --git a/gcc/tree-ssa-threadupdate.c b/gcc/tree-ssa-threadupdate.c index 05d56826a15..15d4d04066e 100644 --- a/gcc/tree-ssa-threadupdate.c +++ b/gcc/tree-ssa-threadupdate.c @@ -403,6 +403,7 @@ ssa_fix_duplicate_block_edges (struct redirection_data *rd, threading through. That's the edge we want to redirect. */ victim = find_edge (rd->dup_block, THREAD_TARGET (e)->dest); e2 = redirect_edge_and_branch (victim, THREAD_TARGET2 (e)->dest); + e2->count = THREAD_TARGET2 (e)->count; /* If we redirected the edge, then we need to copy PHI arguments at the target. If the edge already existed (e2 != victim case), @@ -497,18 +498,8 @@ ssa_redirect_edges (struct redirection_data **slot, free (el); thread_stats.num_threaded_edges++; - /* If we are threading through a joiner block, then we have to - find the edge we want to redirect and update some PHI nodes. */ - if (THREAD_TARGET2 (e)) - { - edge e2; - /* We want to redirect the incoming edge to the joiner block (E) - to instead reach the duplicate of the joiner block. */ - e2 = redirect_edge_and_branch (e, rd->dup_block); - flush_pending_stmts (e2); - } - else if (rd->dup_block) + if (rd->dup_block) { edge e2; @@ -522,9 +513,15 @@ ssa_redirect_edges (struct redirection_data **slot, the computation overflows. */ if (rd->dup_block->frequency < BB_FREQ_MAX * 2) rd->dup_block->frequency += EDGE_FREQUENCY (e); - EDGE_SUCC (rd->dup_block, 0)->count += e->count; - /* Redirect the incoming edge to the appropriate duplicate - block. */ + + /* In the case of threading through a joiner block, the outgoing + edges from the duplicate block were updated when they were + redirected during ssa_fix_duplicate_block_edges. */ + if (!THREAD_TARGET2 (e)) + EDGE_SUCC (rd->dup_block, 0)->count += e->count; + + /* Redirect the incoming edge (possibly to the joiner block) to the + appropriate duplicate block. */ e2 = redirect_edge_and_branch (e, rd->dup_block); gcc_assert (e == e2); flush_pending_stmts (e2); -- 2.11.4.GIT