diff options
author | Richard Guenther <rguenther@suse.de> | 2011-06-10 11:38:14 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-06-10 11:38:14 +0000 |
commit | c1ae3ca5d8842831d35b08e6e9ae1f983b39bc6b (patch) | |
tree | 1b1e1b32ff007fc689d5884181de17646da0a3fd /gcc | |
parent | b504a91833ea26e7469077975b098e3c42551d4e (diff) | |
download | gcc-c1ae3ca5d8842831d35b08e6e9ae1f983b39bc6b.zip gcc-c1ae3ca5d8842831d35b08e6e9ae1f983b39bc6b.tar.gz gcc-c1ae3ca5d8842831d35b08e6e9ae1f983b39bc6b.tar.bz2 |
tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): Scan stmts forward when combining, visit inserted stmts when a stmt was changed.
2011-06-10 Richard Guenther <rguenther@suse.de>
* tree-ssa-forwprop.c (ssa_forward_propagate_and_combine):
Scan stmts forward when combining, visit inserted stmts when
a stmt was changed.
From-SVN: r174900
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/tree-ssa-forwprop.c | 27 |
2 files changed, 28 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fa56bf0..ec2d7e9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-06-10 Richard Guenther <rguenther@suse.de> + + * tree-ssa-forwprop.c (ssa_forward_propagate_and_combine): + Scan stmts forward when combining, visit inserted stmts when + a stmt was changed. + 2011-06-10 Paolo Carlini <paolo.carlini@oracle.com> * tree.h (error_operand_p): Add. diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index 56ba522..77a6264 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -2212,7 +2212,8 @@ ssa_forward_propagate_and_combine (void) FOR_EACH_BB (bb) { - gimple_stmt_iterator gsi; + gimple_stmt_iterator gsi, prev; + bool prev_initialized; /* Apply forward propagation to all stmts in the basic-block. Note we update GSI within the loop as necessary. */ @@ -2304,7 +2305,8 @@ ssa_forward_propagate_and_combine (void) /* Combine stmts with the stmts defining their operands. Note we update GSI within the loop as necessary. */ - for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi);) + prev_initialized = false; + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi);) { gimple stmt = gsi_stmt (gsi); bool changed = false; @@ -2386,9 +2388,24 @@ ssa_forward_propagate_and_combine (void) default:; } - /* If the stmt changed try combining it again. */ - if (!changed) - gsi_prev (&gsi); + if (changed) + { + /* If the stmt changed then re-visit it and the statements + inserted before it. */ + if (!prev_initialized) + gsi = gsi_start_bb (bb); + else + { + gsi = prev; + gsi_next (&gsi); + } + } + else + { + prev = gsi; + prev_initialized = true; + gsi_next (&gsi); + } } } |