PR rtl-optimization/46649
authoramonakov <amonakov@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Dec 2010 13:08:41 +0000 (13:08 +0000)
committeramonakov <amonakov@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Dec 2010 13:08:41 +0000 (13:08 +0000)
* sel-sched-ir.c (purge_empty_blocks): Unconditionally skip the first
basic block in the region.

testsuite:
* g++.dg/opt/pr46649.C: New.

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

gcc/ChangeLog
gcc/sel-sched-ir.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/pr46649.C [new file with mode: 0644]

index 68ac27b..9832ed1 100644 (file)
@@ -1,3 +1,9 @@
+2010-12-15  Alexander Monakov  <amonakov@ispras.ru>
+
+       PR rtl-optimization/46649
+       * sel-sched-ir.c (purge_empty_blocks): Unconditionally skip the first
+       basic block in the region.
+
 2010-12-15  Joseph Myers  <joseph@codesourcery.com>
 
        * config/stormy16/stormy16.h (LINK_SPEC, WCHAR_TYPE): Define.
index 468dfd7..43619d9 100644 (file)
@@ -3766,10 +3766,10 @@ tidy_control_flow (basic_block xbb, bool full_tidying)
 void
 purge_empty_blocks (void)
 {
-  /* Do not attempt to delete preheader.  */
-  int i = sel_is_loop_preheader_p (BASIC_BLOCK (BB_TO_BLOCK (0))) ? 1 : 0;
+  int i;
 
-  while (i < current_nr_blocks)
+  /* Do not attempt to delete the first basic block in the region.  */
+  for (i = 1; i < current_nr_blocks; )
     {
       basic_block b = BASIC_BLOCK (BB_TO_BLOCK (i));
 
index dc836ec..d61278c 100644 (file)
@@ -1,3 +1,8 @@
+2010-12-15  Alexander Monakov  <amonakov@ispras.ru>
+
+       PR rtl-optimization/46649
+       * g++.dg/opt/pr46649.C: New.
+
 2010-12-15  Dave Korn  <dave.korn.cygwin@gmail.com>
 
        PR testsuite/46938
diff --git a/gcc/testsuite/g++.dg/opt/pr46649.C b/gcc/testsuite/g++.dg/opt/pr46649.C
new file mode 100644 (file)
index 0000000..1428e8b
--- /dev/null
@@ -0,0 +1,9 @@
+// { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } }
+// { dg-options "-fschedule-insns -fselective-scheduling" }
+
+void foo ()
+{
+  for (;;)
+    for (;;({break;}))
+    ;
+}