From a87a01ea37562100e898c376013e701d1dcb0290 Mon Sep 17 00:00:00 2001 From: Alexander Monakov Date: Wed, 11 Apr 2018 17:32:32 +0300 Subject: [PATCH] sched-rgn: run add_branch_dependencies for sel-sched (PR 84301) 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 | 6 ++++++ gcc/sched-rgn.c | 9 ++++++--- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr84301.c | 15 +++++++++++++++ 4 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr84301.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 96c7c2874ae..b24df796b6a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-04-11 Alexander Monakov + + 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 PR tree-optimization/85331 diff --git a/gcc/sched-rgn.c b/gcc/sched-rgn.c index 8c3a740b70e..3c67fccb9b1 100644 --- a/gcc/sched-rgn.c +++ b/gcc/sched-rgn.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b473add86db..a1360c9d6ed 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-04-11 Alexander Monakov + + PR target/84301 + * gcc.target/i386/pr84301.c: New test. + 2018-04-11 Jakub Jelinek 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 index 00000000000..7a6b8b14439 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr84301.c @@ -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; +} -- 2.30.2