re PR target/83507 (ICE in internal_dfa_insn_code_* for powerpc targets)
authorJakub Jelinek <jakub@gcc.gnu.org>
Tue, 9 Jan 2018 08:03:45 +0000 (09:03 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 9 Jan 2018 08:03:45 +0000 (09:03 +0100)
PR target/83507
* modulo-sched.c (schedule_reg_moves): Punt if we'd need to move
hard registers.  Formatting fixes.

* gcc.dg/sms-13.c: New test.

From-SVN: r256368

gcc/ChangeLog
gcc/modulo-sched.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/sms-13.c [new file with mode: 0644]

index 7a7736fee19f331c2992a810c7dfeb06054f782c..084b0d7e7c81ffad0626b188bc22acc25496ea93 100644 (file)
@@ -1,5 +1,9 @@
 2018-01-09  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/83507
+       * modulo-sched.c (schedule_reg_moves): Punt if we'd need to move
+       hard registers.  Formatting fixes.
+
        PR preprocessor/83722
        * gcc.c (try_generate_repro): Pass
        &temp_stderr_files[RETRY_ICE_ATTEMPTS - 1] rather than
index d5ad23343f245d585d67e99b277e174c0a4eb7fb..9a27365bfbc4ee4934dd90e7ca86245c9b05bcfc 100644 (file)
@@ -687,9 +687,9 @@ schedule_reg_moves (partial_schedule_ptr ps)
       rtx set = single_set (u->insn);
       
       /* Skip instructions that do not set a register.  */
-      if ((set && !REG_P (SET_DEST (set))))
+      if (set && !REG_P (SET_DEST (set)))
         continue;
+
       /* Compute the number of reg_moves needed for u, by looking at life
         ranges started at u (excluding self-loops).  */
       distances[0] = distances[1] = false;
@@ -743,7 +743,10 @@ schedule_reg_moves (partial_schedule_ptr ps)
       first_move += ps->g->num_nodes;
 
       /* Generate each move.  */
-      old_reg = prev_reg = SET_DEST (single_set (u->insn));
+      old_reg = prev_reg = SET_DEST (set);
+      if (HARD_REGISTER_P (old_reg))
+       return false;
+
       for (i_reg_move = 0; i_reg_move < nreg_moves; i_reg_move++)
        {
          ps_reg_move_info *move = ps_reg_move (ps, first_move + i_reg_move);
index 034c30f26a933d84cc6f1518b29efafa66531685..c73af5e087a71551f66ad2d1eb2c8660bca65371 100644 (file)
@@ -1,6 +1,11 @@
+2018-01-09  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/83507
+       * gcc.dg/sms-13.c: New test.
+
 2018-01-08  Steven G. Kargl  <kargl@gcc.gnu.org>
 
-       PR Fortran/83741
+       PR fortran/83741
        * gfortran.dg/allocate_assumed_charlen_3.f90: New test.
 
 2018-01-08  Chih-Mao Chen <pkmx.tw@gmail.com>
diff --git a/gcc/testsuite/gcc.dg/sms-13.c b/gcc/testsuite/gcc.dg/sms-13.c
new file mode 100644 (file)
index 0000000..cd7bb62
--- /dev/null
@@ -0,0 +1,32 @@
+/* PR target/83507 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fmodulo-sched -fno-tree-ter -fno-tree-coalesce-vars" } */
+
+void
+foo (unsigned short int x, unsigned char y)
+{
+  unsigned char *a = &y;
+  unsigned short int b;
+  int c;
+
+  while (y < 3)
+    {
+      if (x != 0)
+        ++y;
+      ++y;
+    }
+
+  for (c = 0; c < 5; ++c)
+    {
+      int d = 1;
+      d += b > x;
+      y &= d;
+    }
+
+  do
+    {
+      c += y;
+      x = c;
+    }
+  while (x != 0);
+}