sel-sched: run cleanup_cfg just before loop_optimizer_init (PR 84659)
authorAlexander Monakov <amonakov@ispras.ru>
Wed, 11 Apr 2018 10:40:07 +0000 (13:40 +0300)
committerAlexander Monakov <amonakov@gcc.gnu.org>
Wed, 11 Apr 2018 10:40:07 +0000 (13:40 +0300)
PR rtl-optimization/85659
* sel-sched-ir.c (sel_init_pipelining): Invoke cleanup_cfg.

testsuite/
* gcc.dg/pr84659.c: New test.

From-SVN: r259313

gcc/ChangeLog
gcc/sel-sched-ir.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr84659.c [new file with mode: 0644]

index ed58fc2afc9773231efc26e56dcb490388a29beb..d70b106ade48a9b05b6e026217f47d109858e2e7 100644 (file)
@@ -1,3 +1,8 @@
+2018-04-11  Alexander Monakov  <amonakov@ispras.ru>
+
+       PR rtl-optimization/85659
+       * sel-sched-ir.c (sel_init_pipelining): Invoke cleanup_cfg.
+
 2018-04-11  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/85302
index ee970522890423a7a1bb81a4a03553d9f007252e..50a7daafba6889c14fca136ee120e0ffb2ad67b4 100644 (file)
@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "cfgrtl.h"
 #include "cfganal.h"
 #include "cfgbuild.h"
+#include "cfgcleanup.h"
 #include "insn-config.h"
 #include "insn-attr.h"
 #include "recog.h"
@@ -6121,6 +6122,9 @@ make_regions_from_loop_nest (struct loop *loop)
 void
 sel_init_pipelining (void)
 {
+  /* Remove empty blocks: their presence can break assumptions elsewhere,
+     e.g. the logic to invoke update_liveness_on_insn in sel_region_init.  */
+  cleanup_cfg (0);
   /* Collect loop information to be used in outer loops pipelining.  */
   loop_optimizer_init (LOOPS_HAVE_PREHEADERS
                        | LOOPS_HAVE_FALLTHRU_PREHEADERS
index 9f8b16a202323f5a9197c1fd7efc1a3c75d76686..999ce0969f4417106d12fe42a007381cde5c0859 100644 (file)
@@ -1,3 +1,8 @@
+2018-04-11  Alexander Monakov  <amonakov@ispras.ru>
+
+       PR rtl-optimization/85659
+       * gcc.dg/pr84659.c: New test.
+
 2018-04-11  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/85302
diff --git a/gcc/testsuite/gcc.dg/pr84659.c b/gcc/testsuite/gcc.dg/pr84659.c
new file mode 100644 (file)
index 0000000..94c885f
--- /dev/null
@@ -0,0 +1,19 @@
+/* PR rtl-optimization/84659 */
+/* { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O2 -fselective-scheduling -fsel-sched-pipelining -fno-split-wide-types -fno-strict-aliasing -fno-tree-dce" } */
+
+void
+jk (int **lq, int *k4, long long int qv, int od)
+{
+  while (**lq < 1)
+    {
+      int uo;
+
+      uo = ((od == 0) ? qv : *k4) != 1;
+      ++**lq;
+    }
+
+  for (;;)
+    {
+    }
+}