summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dom.c
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2006-03-24 07:51:32 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>2006-03-24 07:51:32 +0000
commitea54ad414795d4a05acf48d28120a796e24514e5 (patch)
treef6d9e217688cbacc0e4fc00e34997e441fd5b063 /gcc/tree-ssa-dom.c
parent1e4fed6981c9d7ae7d4a0c73c15b771ddd1da462 (diff)
downloadgcc-ea54ad414795d4a05acf48d28120a796e24514e5.tar.gz
* tree-ssa-dom.c (propagate_rhs_into_lhs): Temporarily work
around bug in immediate-use iterator. * gcc.c-torture/compile/pr26833.c: New test. * gfortran.fortran-torture/compile/pr26806.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112348 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-dom.c')
-rw-r--r--gcc/tree-ssa-dom.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index daa2f0ea81d..9df59e9dc52 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -2134,6 +2134,7 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
/* Walk over every use of LHS and try to replace the use with RHS.
At this point the only reason why such a propagation would not
be successful would be if the use occurs in an ASM_EXPR. */
+ repeat:
FOR_EACH_IMM_USE_SAFE (use_p, iter, lhs)
{
tree use_stmt = USE_STMT (use_p);
@@ -2264,6 +2265,24 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
}
}
+ /* Due to a bug in the immediate use iterator code, we can
+ miss visiting uses in some cases when there is more than
+ one use in a statement. Missing a use can cause a multitude
+ of problems if we expected to eliminate all uses and remove
+ the defining statement.
+
+ Until Andrew can fix the iterator, this hack will detect
+ the cases which cause us problems. Namely if ALL is set
+ and we still have some immediate uses, then we must have
+ skipped one or more in the loop above. So just re-execute
+ the loop.
+
+ The maximum number of times we can re-execute the loop is
+ bounded by the maximum number of times a given SSA_NAME
+ appears in a single statement. */
+ if (all && num_imm_uses (lhs) != 0)
+ goto repeat;
+
/* If we were able to propagate away all uses of LHS, then
we can remove STMT. */
if (all)