diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 55694f0573c..39caec6a6eb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2007-09-06 Richard Guenther + + PR tree-optimization/33302 + * domwalk.c (walk_dominator_tree): The exit block is + interesting even if it is not reachable. + 2007-09-06 Richard Sandiford PR middle-end/33306 diff --git a/gcc/domwalk.c b/gcc/domwalk.c index a58437ec27c..fb7f0729d3d 100644 --- a/gcc/domwalk.c +++ b/gcc/domwalk.c @@ -151,7 +151,9 @@ walk_dominator_tree (struct dom_walk_data *walk_data, basic_block bb) while (true) { /* Don't worry about unreachable blocks. */ - if (EDGE_COUNT (bb->preds) > 0 || bb == ENTRY_BLOCK_PTR) + if (EDGE_COUNT (bb->preds) > 0 + || bb == ENTRY_BLOCK_PTR + || bb == EXIT_BLOCK_PTR) { /* If block BB is not interesting to the caller, then none of the callbacks that walk the statements in BB are going to be diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c48beda0672..c6bb8f8ec8e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-09-06 Richard Guenther + + PR tree-optimization/33302 + * gcc.dg/tree-ssa/ssa-dse-11.c: New testcase. + 2007-09-06 Jerry DeLisle PR libfortran/33225 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-11.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-11.c new file mode 100644 index 00000000000..bd66bc2a78e --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-11.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-dse1-details" } */ + +extern void abort(void); +void foo(int *p) +{ + while (1) + { + *p = 0; + *p = 0; + } +} +void bar(int *p) +{ + *p = 0; + *p = 0; + abort (); +} + +/* { dg-final { scan-tree-dump-times "Deleted dead store" 2 "dse1" } } */ +/* { dg-final { cleanup-tree-dump "dse1" } } */