PR rtl-optimization/44469
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 26 Jan 2011 21:11:57 +0000 (21:11 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 26 Jan 2011 21:11:57 +0000 (21:11 +0000)
* cfgcleanup.c (try_optimize_cfg): Iterate in CFG layout mode too
after removing trivially dead basic blocks.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@169304 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cfgcleanup.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20110126-1.c [new file with mode: 0644]

index 606715d..fa574e8 100644 (file)
@@ -1,3 +1,9 @@
+2011-01-26  Eric Botcazou  <ebotcazou@adacore.com>
+
+       PR rtl-optimization/44469
+       * cfgcleanup.c (try_optimize_cfg): Iterate in CFG layout mode too
+       after removing trivially dead basic blocks.
+
 2011-01-26  Joseph Myers  <joseph@codesourcery.com>
 
        * config/bfin/bfin.h (LINK_SPEC): Remove %{Qy:} %{!Qn:-Qy}.
index bf6ca45..aaa0ea5 100644 (file)
@@ -2341,8 +2341,7 @@ try_optimize_cfg (int mode)
                        }
                    }
                  delete_basic_block (b);
-                 if (!(mode & CLEANUP_CFGLAYOUT))
-                   changed = true;
+                 changed = true;
                  /* Avoid trying to remove ENTRY_BLOCK_PTR.  */
                  b = (c == ENTRY_BLOCK_PTR ? c->next_bb : c);
                  continue;
index 2744712..e5133d0 100644 (file)
@@ -1,3 +1,7 @@
+2011-01-26  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc.c-torture/compile/20110126-1.c: New test.
+
 2011-01-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/47473
diff --git a/gcc/testsuite/gcc.c-torture/compile/20110126-1.c b/gcc/testsuite/gcc.c-torture/compile/20110126-1.c
new file mode 100644 (file)
index 0000000..c55e0c2
--- /dev/null
@@ -0,0 +1,18 @@
+/* PR rtl-optimization/44469 */
+/* Testcase by Siarhei Siamashka <siarhei.siamashka@gmail.com> */
+
+int a (int *t, const char *p)
+{
+  if (*t == 0)
+    {
+    }
+  else if (*t == 1)
+    {
+      p = (const char *)t;
+    }
+  else
+    __builtin_unreachable();
+  if (p[0])
+    return 0;
+  return 1;
+}