]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/33302 (dead-store not eliminated)
authorRichard Guenther <rguenther@suse.de>
Thu, 6 Sep 2007 09:05:58 +0000 (09:05 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 6 Sep 2007 09:05:58 +0000 (09:05 +0000)
2007-09-06  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/33302
* tree-ssa-dse.c (tree_ssa_dse): Connect infinite loops
to the exit block before doing the post-dominator walk.
* 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.

From-SVN: r128180

gcc/ChangeLog
gcc/domwalk.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/ssa-dse-11.c [new file with mode: 0644]

index 55694f0573c10104b0e94b657aef872e56e9128b..39caec6a6ebaf668b76f570f91541236e1c0e4e3 100644 (file)
@@ -1,3 +1,9 @@
+2007-09-06  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.
+
 2007-09-06  Richard Sandiford  <richard@codesourcery.com>
 
        PR middle-end/33306
index a58437ec27c4a409510cf71ce8bbb4c4fdc04518..fb7f0729d3da4f453bcbaf3a20020183cab912d0 100644 (file)
@@ -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
index c48beda0672808e273e16ee560e4c59c1b990b4d..c6bb8f8ec8e3d8182c164fd6ae9d6d9df7abc18a 100644 (file)
@@ -1,3 +1,8 @@
+2007-09-06  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/33302
+       * gcc.dg/tree-ssa/ssa-dse-11.c: New testcase.
+
 2007-09-06  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        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 (file)
index 0000000..bd66bc2
--- /dev/null
@@ -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" } } */