aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-03-31 18:37:41 +0000
committerSebastian Pop <spop@gcc.gnu.org>2010-03-31 18:37:41 +0000
commit3cbf7085c3bab213304e9e3237128da2879cc8b8 (patch)
tree82ac9c3853c6d19667fbda347ad66d715a9bf1be /gcc
parent40bf935e85b60e7d110d028bf975558589abef8c (diff)
downloadgcc-3cbf7085c3bab213304e9e3237128da2879cc8b8.zip
gcc-3cbf7085c3bab213304e9e3237128da2879cc8b8.tar.gz
gcc-3cbf7085c3bab213304e9e3237128da2879cc8b8.tar.bz2
Fix PR43464: copyprop should maintain loop close phi nodes with multiple arguments.
2010-03-30 Richard Guenther <rguenther@suse.de> Zdenek Dvorak <ook@ucw.cz> Sebastian Pop <sebastian.pop@amd.com> PR middle-end/43464 * tree-ssa-copy.c (init_copy_prop): Handle loop close phi nodes with multiple arguments. (execute_copy_prop): Remove call to rewrite_into_loop_closed_ssa. Co-Authored-By: Sebastian Pop <sebastian.pop@amd.com> Co-Authored-By: Zdenek Dvorak <ook@ucw.cz> From-SVN: r157889
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog.graphite9
-rw-r--r--gcc/tree-ssa-copy.c20
2 files changed, 23 insertions, 6 deletions
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 3cfb29b..6ce22cb 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,3 +1,12 @@
+2010-03-30 Richard Guenther <rguenther@suse.de>
+ Zdenek Dvorak <ook@ucw.cz>
+ Sebastian Pop <sebastian.pop@amd.com>
+
+ PR middle-end/43464
+ * tree-ssa-copy.c (init_copy_prop): Handle loop close phi nodes
+ with multiple arguments.
+ (execute_copy_prop): Remove call to rewrite_into_loop_closed_ssa.
+
2010-03-23 Sebastian Pop <sebastian.pop@amd.com>
* graphite-dependences.c (print_pddr): Call print_pdr with an
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
index 4b8d0b9..5ee51e0 100644
--- a/gcc/tree-ssa-copy.c
+++ b/gcc/tree-ssa-copy.c
@@ -749,6 +749,7 @@ init_copy_prop (void)
{
gimple_stmt_iterator si;
int depth = bb->loop_depth;
+ bool loop_exit_p = false;
for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
@@ -786,6 +787,18 @@ init_copy_prop (void)
cached_last_copy_of[SSA_NAME_VERSION (def)] = def;
}
+ /* In loop-closed SSA form do not copy-propagate through
+ PHI nodes in blocks with a loop exit edge predecessor. */
+ if (current_loops
+ && loops_state_satisfies_p (LOOP_CLOSED_SSA))
+ {
+ edge_iterator ei;
+ edge e;
+ FOR_EACH_EDGE (e, ei, bb->preds)
+ if (loop_exit_edge_p (e->src->loop_father, e))
+ loop_exit_p = true;
+ }
+
for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
{
gimple phi = gsi_stmt (si);
@@ -793,12 +806,7 @@ init_copy_prop (void)
def = gimple_phi_result (phi);
if (!is_gimple_reg (def)
- /* In loop-closed SSA form do not copy-propagate through
- PHI nodes. Technically this is only needed for loop
- exit PHIs, but this is difficult to query. */
- || (current_loops
- && gimple_phi_num_args (phi) == 1
- && loops_state_satisfies_p (LOOP_CLOSED_SSA)))
+ || loop_exit_p)
prop_set_simulate_again (phi, false);
else
prop_set_simulate_again (phi, true);