This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR33302, make domwalk from the exit bb always do something
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 5 Sep 2007 16:32:36 +0200 (CEST)
- Subject: [PATCH] Fix PR33302, make domwalk from the exit bb always do something
This special-cases EXIT_BLOCK_PTR just like it does ENTRY_BLOCK_PTR for
testing of interestingness because of unreachability. Which allows DSE
to do its work for functions that do not terminate.
Bootstrap and regtest on x86_64-unknown-linux-gnu in progress.
Richard.
2007-08-05 Richard Guenther <rguenther@suse.de>
PR tree-optimization/33302
* domwalk.c (walk_dominator_tree): The exit block is
interesting even if it is not reachable.
* gcc.dg/tree-ssa/ssa-dse-11.c: New testcase.
Index: testsuite/gcc.dg/tree-ssa/ssa-dse-11.c
===================================================================
*** testsuite/gcc.dg/tree-ssa/ssa-dse-11.c (revision 0)
--- testsuite/gcc.dg/tree-ssa/ssa-dse-11.c (revision 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" } } */
Index: domwalk.c
===================================================================
*** domwalk.c (revision 128123)
--- domwalk.c (working copy)
*************** walk_dominator_tree (struct dom_walk_dat
*** 151,157 ****
while (true)
{
/* Don't worry about unreachable blocks. */
! if (EDGE_COUNT (bb->preds) > 0 || bb == ENTRY_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
--- 151,159 ----
while (true)
{
/* Don't worry about unreachable blocks. */
! 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