From 8d64622fceaac7f27b6e7c35fca9f91236f34b8d Mon Sep 17 00:00:00 2001 From: Roman Zhuykov Date: Tue, 23 Apr 2019 12:53:43 +0000 Subject: [PATCH] modulo-sched: fix branch scheduling issue (PR84032) PR rtl-optimization/84032 * modulo-sched.c (ps_insn_find_column): Change condition so that branch will always be the last insn in a row inside partial schedule. testsuite: PR rtl-optimization/84032 * gcc.dg/pr84032.c: New test. From-SVN: r270511 --- gcc/ChangeLog | 7 +++++++ gcc/modulo-sched.c | 4 +--- gcc/testsuite/ChangeLog | 9 +++++++-- gcc/testsuite/gcc.dg/pr84032.c | 23 +++++++++++++++++++++++ 4 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr84032.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0823ca9bcfa..f7109468b97 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-04-23 Roman Zhuykov + + PR rtl-optimization/84032 + * modulo-sched.c (ps_insn_find_column): Change condition so that + branch will always be the last insn in a row inside partial + schedule. + 2019-04-23 Richard Biener PR debug/90131 diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c index 7ead2582eb3..44014a06387 100644 --- a/gcc/modulo-sched.c +++ b/gcc/modulo-sched.c @@ -2996,9 +2996,7 @@ ps_insn_find_column (partial_schedule_ptr ps, ps_insn_ptr ps_i, last_must_precede = next_ps_i; } /* The closing branch must be the last in the row. */ - if (must_precede - && bitmap_bit_p (must_precede, next_ps_i->id) - && JUMP_P (ps_rtl_insn (ps, next_ps_i->id))) + if (JUMP_P (ps_rtl_insn (ps, next_ps_i->id))) return false; last_in_row = next_ps_i; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7c656418c8e..029bad5ae95 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,12 +1,17 @@ +2019-04-23 Roman Zhuykov + + PR rtl-optimization/84032 + * gcc.dg/pr84032.c: New test. + 2018-04-23 Bin Cheng PR tree-optimization/90078 - * gcc/testsuite/g++.dg/tree-ssa/pr90078.C: New test. + * g++.dg/tree-ssa/pr90078.C: New test. 2018-04-23 Bin Cheng PR tree-optimization/90021 - * gcc/testsuite/gfortran.dg/pr90021.f90: New test. + * gfortran.dg/pr90021.f90: New test. 2019-04-22 Steven G. Kargl diff --git a/gcc/testsuite/gcc.dg/pr84032.c b/gcc/testsuite/gcc.dg/pr84032.c new file mode 100644 index 00000000000..c295d9a0dae --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr84032.c @@ -0,0 +1,23 @@ +/* PR rtl-optimization/84032 */ +/* { dg-do compile } */ +/* { dg-options "-O1 -fmodulo-sched" } */ +/* { dg-additional-options "-mcpu=power6" { target { powerpc-*-* } } } */ + +void +yr (int cm) +{ + int ka = cm; + + for (;;) + { + short int m0; + + for (m0 = 0; m0 < 6; ++m0) + { + ka &= 1; + cm *= 2; + } + + ka = (ka == 0) ? cm : 0; + } +} -- 2.30.2