diff options
author | Roman Zhuykov <zhroma@ispras.ru> | 2019-12-13 17:33:38 +0000 |
---|---|---|
committer | Roman Zhuykov <zhroma@gcc.gnu.org> | 2019-12-13 17:33:38 +0000 |
commit | faab8a70f2c40758c8bb15303098f3b824bafb60 (patch) | |
tree | 38e16ed2a5fd5e9cd6d0de66e5197250d562efa3 /gcc | |
parent | c420be8b3c5fd9e9d80dd583e790f0c2a7c4954b (diff) | |
download | gcc-faab8a70f2c40758c8bb15303098f3b824bafb60.zip gcc-faab8a70f2c40758c8bb15303098f3b824bafb60.tar.gz gcc-faab8a70f2c40758c8bb15303098f3b824bafb60.tar.bz2 |
modulo-sched: fix branch rescheduling issue (PR92591)
PR rtl-optimization/92591
* modulo-sched.c (ps_add_node_check_conflicts): Improve checking
for history > 0 case.
testsuite:
PR rtl-optimization/92591
* gcc.dg/pr92951-1.c: New test.
* gcc.dg/pr92951-2.c: New test.
From-SVN: r279377
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/modulo-sched.c | 39 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr92951-1.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr92951-2.c | 5 |
5 files changed, 53 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 56d05cc..f8a56a4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2019-12-13 Roman Zhuykov <zhroma@ispras.ru> + PR rtl-optimization/92591 + * modulo-sched.c (ps_add_node_check_conflicts): Improve checking + for history > 0 case. + +2019-12-13 Roman Zhuykov <zhroma@ispras.ru> + * modulo-sched.c (sms_schedule): Use param_sms_max_ii_factor value instead of macro. Adjust comment. (sms_schedule_by_order): Use parameter value without macro. @@ -8,6 +14,7 @@ 2019-12-13 Roman Zhuykov <zhroma@ispras.ru> + PR rtl-optimization/90001 * ddg.c (create_ddg): Init max_dist array for each node. (free_ddg): Free max_dist array. (create_ddg_edge): Use bool field instead of aux union. diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c index 2dc9af7..ddc2874 100644 --- a/gcc/modulo-sched.c +++ b/gcc/modulo-sched.c @@ -3197,7 +3197,7 @@ ps_add_node_check_conflicts (partial_schedule_ptr ps, int n, int c, sbitmap must_precede, sbitmap must_follow) { - int has_conflicts = 0; + int i, first, amount, has_conflicts = 0; ps_insn_ptr ps_i; /* First add the node to the PS, if this succeeds check for @@ -3205,23 +3205,32 @@ ps_add_node_check_conflicts (partial_schedule_ptr ps, int n, if (! (ps_i = add_node_to_ps (ps, n, c, must_precede, must_follow))) return NULL; /* Failed to insert the node at the given cycle. */ - has_conflicts = ps_has_conflicts (ps, c, c) - || (ps->history > 0 - && ps_has_conflicts (ps, - c - ps->history, - c + ps->history)); - - /* Try different issue slots to find one that the given node can be - scheduled in without conflicts. */ - while (has_conflicts) + while (1) { + has_conflicts = ps_has_conflicts (ps, c, c); + if (ps->history > 0 && !has_conflicts) + { + /* Check all 2h+1 intervals, starting from c-2h..c up to c..2h, + but not more than ii intervals. */ + first = c - ps->history; + amount = 2 * ps->history + 1; + if (amount > ps->ii) + amount = ps->ii; + for (i = first; i < first + amount; i++) + { + has_conflicts = ps_has_conflicts (ps, + i - ps->history, + i + ps->history); + if (has_conflicts) + break; + } + } + if (!has_conflicts) + break; + /* Try different issue slots to find one that the given node can be + scheduled in without conflicts. */ if (! ps_insn_advance_column (ps, ps_i, must_follow)) break; - has_conflicts = ps_has_conflicts (ps, c, c) - || (ps->history > 0 - && ps_has_conflicts (ps, - c - ps->history, - c + ps->history)); } if (has_conflicts) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7ea9f58..2a4d9a0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-12-13 Roman Zhuykov <zhroma@ispras.ru> + + PR rtl-optimization/92591 + * gcc.dg/pr92951-1.c: New test. + * gcc.dg/pr92951-2.c: New test. + 2019-12-13 Dennis Zhang <dennis.zhang@arm.com> * gcc.target/aarch64/pragma_cpp_predefs_2.c: Add tests for i8mm diff --git a/gcc/testsuite/gcc.dg/pr92951-1.c b/gcc/testsuite/gcc.dg/pr92951-1.c new file mode 100644 index 0000000..0f9365d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr92951-1.c @@ -0,0 +1,11 @@ +/* PR rtl-optimization/92591 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fmodulo-sched -fweb -fno-dce -fno-ivopts -fno-sched-pressure -fno-tree-loop-distribute-patterns --param sms-dfa-history=1" } */ +/* { dg-additional-options "-mcpu=e500mc" { target { powerpc-*-* } } } */ + +void +wf (char *mr, int tc) +{ + while (tc-- > 0) + *mr++ = 0; +} diff --git a/gcc/testsuite/gcc.dg/pr92951-2.c b/gcc/testsuite/gcc.dg/pr92951-2.c new file mode 100644 index 0000000..04a8092 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr92951-2.c @@ -0,0 +1,5 @@ +/* PR rtl-optimization/92591 */ +/* { dg-do compile } */ +/* { dg-options "-Os -fmodulo-sched -fmodulo-sched-allow-regmoves --param sms-dfa-history=8" } */ + +#include "../gcc.c-torture/execute/pr61682.c" |