]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR debug/61923 (-fcompare-debug errors while building Linux kernel.)
authorJakub Jelinek <jakub@redhat.com>
Mon, 8 Sep 2014 19:07:00 +0000 (21:07 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 8 Sep 2014 19:07:00 +0000 (21:07 +0200)
Backported from mainline
2014-08-06  Vladimir Makarov  <vmakarov@redhat.com>

PR debug/61923
* haifa-sched.c (advance_one_cycle): Fix dump.
(schedule_block): Don't advance cycle if we are already at the
beginning of the cycle.

* gcc.target/i386/pr61923.c: New test.

From-SVN: r215020

gcc/ChangeLog
gcc/haifa-sched.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr61923.c [new file with mode: 0644]

index 7f7642fa6a73b6b7648d38adfda58c8279d99967..4c26c28841db7867a7e09b06ed88cdbd7c739e3c 100644 (file)
@@ -1,3 +1,13 @@
+2014-09-08  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2014-08-06  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR debug/61923
+       * haifa-sched.c (advance_one_cycle): Fix dump.
+       (schedule_block): Don't advance cycle if we are already at the
+       beginning of the cycle.
+
 2014-09-03  Martin Jambor  <mjambor@suse.cz>
 
        PR ipa/62015
index c4591bfe35b9d855309bda5c9a8780d5dd7b51a9..28934c5d9e86a3ff6439390886f83d49de150673 100644 (file)
@@ -2931,7 +2931,7 @@ advance_one_cycle (void)
 {
   advance_state (curr_state);
   if (sched_verbose >= 6)
-    fprintf (sched_dump, ";;\tAdvanced a state.\n");
+    fprintf (sched_dump, ";;\tAdvance the current state.\n");
 }
 
 /* Update register pressure after scheduling INSN.  */
@@ -5964,6 +5964,7 @@ schedule_block (basic_block *target_bb, state_t init_state)
   modulo_insns_scheduled = 0;
 
   ls.modulo_epilogue = false;
+  ls.first_cycle_insn_p = true;
 
   /* Loop until all the insns in BB are scheduled.  */
   while ((*current_sched_info->schedule_more_p) ())
@@ -6034,7 +6035,6 @@ schedule_block (basic_block *target_bb, state_t init_state)
       if (must_backtrack)
        goto do_backtrack;
 
-      ls.first_cycle_insn_p = true;
       ls.shadows_only_p = false;
       cycle_issued_insns = 0;
       ls.can_issue_more = issue_rate;
@@ -6321,11 +6321,13 @@ schedule_block (basic_block *target_bb, state_t init_state)
              break;
            }
        }
+      ls.first_cycle_insn_p = true;
     }
   if (ls.modulo_epilogue)
     success = true;
  end_schedule:
-  advance_one_cycle ();
+  if (!ls.first_cycle_insn_p)
+    advance_one_cycle ();
   perform_replacements_new_cycle ();
   if (modulo_ii > 0)
     {
index 0c91c6d5859134a9132c3485a4cd7910ac7e1b95..a61807021f95efb9260dd40b07eb1d317efa3a12 100644 (file)
@@ -1,3 +1,11 @@
+2014-09-08  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2014-08-06  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR debug/61923
+       * gcc.target/i386/pr61923.c: New test.
+
 2014-09-06  John David Anglin  <danglin@gcc.gnu.org>
 
        PR testsuite/56194
diff --git a/gcc/testsuite/gcc.target/i386/pr61923.c b/gcc/testsuite/gcc.target/i386/pr61923.c
new file mode 100644 (file)
index 0000000..458158c
--- /dev/null
@@ -0,0 +1,36 @@
+/* PR debug/61923 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcompare-debug" } */
+
+typedef struct
+{
+  struct
+  {
+    struct
+    {
+      char head;
+    } tickets;
+  };
+} arch_spinlock_t;
+struct ext4_map_blocks
+{
+  int m_lblk;
+  int m_len;
+  int m_flags;
+};
+int ext4_da_map_blocks_ei_0;
+void fn1 (int p1, struct ext4_map_blocks *p2)
+{
+  int ret;
+  if (p2->m_flags)
+    {
+      ext4_da_map_blocks_ei_0++;
+      arch_spinlock_t *lock;
+      switch (sizeof *&lock->tickets.head)
+      case 1:
+      asm("" : "+m"(*&lock->tickets.head) : ""(0));
+      __asm__("");
+      ret = 0;
+    }
+  fn2 (p2->m_lblk, p2->m_len);
+}