2018-04-19  Richard Biener  <rguenther@suse.de>
	PR middle-end/85455
	* cfg.c (clear_bb_flags): When loop state says we have
	marked irreducible regions also preserve BB_IRREDUCIBLE_LOOP.
	* gcc.dg/pr85455.c: New testcase.
From-SVN: r259494
+2018-04-19  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/85455
+       * cfg.c (clear_bb_flags): When loop state says we have
+       marked irreducible regions also preserve BB_IRREDUCIBLE_LOOP.
+
 2018-04-19  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/84737
 
 clear_bb_flags (void)
 {
   basic_block bb;
+  int flags_to_preserve = BB_FLAGS_TO_PRESERVE;
+  if (current_loops
+      && loops_state_satisfies_p (cfun, LOOPS_HAVE_MARKED_IRREDUCIBLE_REGIONS))
+    flags_to_preserve |= BB_IRREDUCIBLE_LOOP;
 
   FOR_ALL_BB_FN (bb, cfun)
-    bb->flags &= BB_FLAGS_TO_PRESERVE;
+    bb->flags &= flags_to_preserve;
 }
 \f
 /* Check the consistency of profile information.  We can't do that
 
+2018-04-19  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/85455
+       * gcc.dg/pr85455.c: New testcase.
+
 2018-04-19  Christophe Lyon  <christophe.lyon@linaro.org>
 
        * g++.dg/lto/pr85405_0.C: Require shared and fpic effective
 
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O1 -fthread-jumps -fno-tree-dominator-opts -fno-tree-reassoc -fno-tree-sink -fno-tree-slsr" } */
+
+void
+ty (void);
+
+void
+um (void);
+
+void
+au (int qj)
+{
+  if (qj < 1)
+    {
+vq:
+      ty ();
+    }
+
+  um ();
+
+  goto vq;
+}