re PR rtl-optimization/83962 (ICE: verify_flow_info failed (too many outgoing branch...
authorAndrey Belevantsev <abel@ispras.ru>
Mon, 9 Apr 2018 09:16:34 +0000 (12:16 +0300)
committerAndrey Belevantsev <abel@gcc.gnu.org>
Mon, 9 Apr 2018 09:16:34 +0000 (12:16 +0300)
       PR rtl-optimization/83962

       * sel-sched-ir.c (tidy_control_flow): Correct the order in which we call
       tidy_fallthru_edge and tidy_control_flow.

       * gcc.dg/pr83962.c: New test.

From-SVN: r259229

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

index a09b7bafed9678c11af96ca004106797de717360..99d9ccacd36d3b39a2dbeec7517ee6d2df8e880d 100644 (file)
@@ -1,3 +1,10 @@
+2018-04-09  Andrey Belevantsev  <abel@ispras.ru>
+
+       PR rtl-optimization/83962
+
+       * sel-sched-ir.c (tidy_control_flow): Correct the order in which we call
+       tidy_fallthru_edge and tidy_control_flow.
+
 2018-04-09  Andrey Belevantsev  <abel@ispras.ru>
 
        PR rtl-optimization/83530
index a965d2ec42fe8563e2dc5affe6078f4734f18958..987bd9f93cf440da5258c0da10885220bdded605 100644 (file)
@@ -3839,9 +3839,13 @@ tidy_control_flow (basic_block xbb, bool full_tidying)
       && INSN_SCHED_TIMES (BB_END (xbb)) == 0
       && !IN_CURRENT_FENCE_P (BB_END (xbb)))
     {
-      if (sel_remove_insn (BB_END (xbb), false, false))
-        return true;
+      /* We used to call sel_remove_insn here that can trigger tidy_control_flow
+         before we fix up the fallthru edge.  Correct that ordering by
+        explicitly doing the latter before the former.  */
+      clear_expr (INSN_EXPR (BB_END (xbb)));
       tidy_fallthru_edge (EDGE_SUCC (xbb, 0));
+      if (tidy_control_flow (xbb, false))
+       return true;
     }
 
   first = sel_bb_head (xbb);
index c1653f726aca51f899af6ab2a8965b925d083bfa..91a1a2f8973d06370e685915db8ff228b2cb4b11 100644 (file)
@@ -1,3 +1,8 @@
+2018-04-09  Andrey Belevantsev  <abel@ispras.ru>
+
+       PR rtl-optimization/83962
+       * gcc.dg/pr83962.c: New test.
+
 2018-04-09  Andrey Belevantsev  <abel@ispras.ru>
 
        PR rtl-optimization/83530
diff --git a/gcc/testsuite/gcc.dg/pr83962.c b/gcc/testsuite/gcc.dg/pr83962.c
new file mode 100644 (file)
index 0000000..0547e21
--- /dev/null
@@ -0,0 +1,10 @@
+/* { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } } */
+/* { dg-options "-std=gnu99 -O1 -fselective-scheduling2 -fschedule-insns2 -fcse-follow-jumps -fno-ssa-phiopt -fno-guess-branch-probability" } */
+unsigned int ca;
+
+void
+v6 (long long unsigned int as, int p9)
+{
+  while (p9 < 1)
+    as = (as != ca) || (as > 1);
+}