modulo-sched: fix branch scheduling issue (PR84032)
authorRoman Zhuykov <zhroma@gcc.gnu.org>
Tue, 23 Apr 2019 12:53:43 +0000 (12:53 +0000)
committerRoman Zhuykov <zhroma@gcc.gnu.org>
Tue, 23 Apr 2019 12:53:43 +0000 (12:53 +0000)
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
gcc/modulo-sched.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr84032.c [new file with mode: 0644]

index 0823ca9bcfaf69aae630343958b6a9604586c5df..f7109468b9740539a5dbd29e22d9ab484c508e90 100644 (file)
@@ -1,3 +1,10 @@
+2019-04-23  Roman Zhuykov  <zhroma@ispras.ru>
+
+       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  <rguenther@suse.de>
 
        PR debug/90131
index 7ead2582eb39c55a99b8d890618f3d55f0eb12a4..44014a063878d596dee63f4ad1f2889dc3600940 100644 (file)
@@ -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;
index 7c656418c8ef18493d991e313e95674361b0cc93..029bad5ae95991fa7c39bd1f544c756c3dba885a 100644 (file)
@@ -1,12 +1,17 @@
+2019-04-23  Roman Zhuykov  <zhroma@ispras.ru>
+
+       PR rtl-optimization/84032
+       * gcc.dg/pr84032.c: New test.
+
 2018-04-23  Bin Cheng  <bin.cheng@linux.alibaba.com>
 
        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  <bin.cheng@linux.alibaba.com>
 
        PR tree-optimization/90021
-       * gcc/testsuite/gfortran.dg/pr90021.f90: New test.
+       * gfortran.dg/pr90021.f90: New test.
 
 2019-04-22  Steven G. Kargl  <kargl@gcc.gnu.org>
 
diff --git a/gcc/testsuite/gcc.dg/pr84032.c b/gcc/testsuite/gcc.dg/pr84032.c
new file mode 100644 (file)
index 0000000..c295d9a
--- /dev/null
@@ -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;
+    }
+}