sched-rgn: run add_branch_dependencies for sel-sched (PR 84301)
authorAlexander Monakov <amonakov@ispras.ru>
Wed, 11 Apr 2018 14:32:32 +0000 (17:32 +0300)
committerAlexander Monakov <amonakov@gcc.gnu.org>
Wed, 11 Apr 2018 14:32:32 +0000 (17:32 +0300)
PR target/84301
* sched-rgn.c (add_branch_dependences): Move sel_sched_p check here...
(compute_block_dependences): ... from here.

testsuite/
* gcc.target/i386/pr84301.c: New test.

From-SVN: r259321

gcc/ChangeLog
gcc/sched-rgn.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr84301.c [new file with mode: 0644]

index 96c7c2874aead9380b18273557a567e30903d5cd..b24df796b6a8a6219f9bf2655be93d52eb85da6c 100644 (file)
@@ -1,3 +1,9 @@
+2018-04-11  Alexander Monakov  <amonakov@ispras.ru>
+
+       PR target/84301
+       * sched-rgn.c (add_branch_dependences): Move sel_sched_p check here...
+       (compute_block_dependences): ... from here.
+
 2018-04-11  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/85331
index 8c3a740b70e9f0b8fa04ba413b18fd5d7d774f90..3c67fccb9b18a5efead9fb29efdcab72e4754574 100644 (file)
@@ -2497,6 +2497,11 @@ add_branch_dependences (rtx_insn *head, rtx_insn *tail)
       while (insn != head && DEBUG_INSN_P (insn));
     }
 
+  /* Selective scheduling handles control dependencies by itself, and
+     CANT_MOVE flags ensure that other insns will be kept in place.  */
+  if (sel_sched_p ())
+    return;
+
   /* Make sure these insns are scheduled last in their block.  */
   insn = last;
   if (insn != 0)
@@ -2725,9 +2730,7 @@ compute_block_dependences (int bb)
 
   sched_analyze (&tmp_deps, head, tail);
 
-  /* Selective scheduling handles control dependencies by itself.  */
-  if (!sel_sched_p ())
-    add_branch_dependences (head, tail);
+  add_branch_dependences (head, tail);
 
   if (current_nr_blocks > 1)
     propagate_deps (bb, &tmp_deps);
index b473add86db294dfed9512cc75b8d15bb2fa1d5e..a1360c9d6ed7962c272daee7b60e5b9bec04b42f 100644 (file)
@@ -1,3 +1,8 @@
+2018-04-11  Alexander Monakov  <amonakov@ispras.ru>
+
+       PR target/84301
+       * gcc.target/i386/pr84301.c: New test.
+
 2018-04-11  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/85331
diff --git a/gcc/testsuite/gcc.target/i386/pr84301.c b/gcc/testsuite/gcc.target/i386/pr84301.c
new file mode 100644 (file)
index 0000000..7a6b8b1
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR target/84301 */
+/* { dg-do compile } */
+/* { dg-options "-march=bdver1 -O1 -fexpensive-optimizations -fschedule-insns -fselective-scheduling -fno-dce -fno-tree-dce --param max-pending-list-length=0 --param selsched-max-lookahead=2" } */
+
+int lr;
+long int xl;
+
+int
+v4 (void)
+{
+  int mp;
+
+  ++xl;
+  mp = (lr - xl) > 1;
+}