PR rtl-optimization/85659
	* sel-sched-ir.c (sel_init_pipelining): Invoke cleanup_cfg.
testsuite/
	* gcc.dg/pr84659.c: New test.
From-SVN: r259313
+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
 
 #include "cfgrtl.h"
 #include "cfganal.h"
 #include "cfgbuild.h"
+#include "cfgcleanup.h"
 #include "insn-config.h"
 #include "insn-attr.h"
 #include "recog.h"
 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
 
+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
 
--- /dev/null
+/* 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 (;;)
+    {
+    }
+}