OSDN Git Service

PR debug/51557
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Dec 2011 15:21:48 +0000 (15:21 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Dec 2011 15:21:48 +0000 (15:21 +0000)
* sel-sched-ir.c (create_copy_of_insn_rtx): Copy all notes
other than REG_EQUAL, REG_EQUIV and REG_LABEL_OPERAND.

* gcc.dg/pr51557.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182404 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/sel-sched-ir.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr51557.c [new file with mode: 0644]

index 7d780ba..1b7a743 100644 (file)
@@ -1,5 +1,9 @@
 2011-12-16  Jakub Jelinek  <jakub@redhat.com>
 
 2011-12-16  Jakub Jelinek  <jakub@redhat.com>
 
+       PR debug/51557
+       * sel-sched-ir.c (create_copy_of_insn_rtx): Copy all notes
+       other than REG_EQUAL, REG_EQUIV and REG_LABEL_OPERAND.
+
        PR tree-optimization/51576
        * tree-cfg.c (replace_uses_by): Call maybe_clean_or_replace_eh_stmt
        even if fold_stmt didn't change anything.
        PR tree-optimization/51576
        * tree-cfg.c (replace_uses_by): Call maybe_clean_or_replace_eh_stmt
        even if fold_stmt didn't change anything.
index dacee0b..a93cd68 100644 (file)
@@ -5723,7 +5723,7 @@ create_vinsn_from_insn_rtx (rtx insn_rtx, bool force_unique_p)
 rtx
 create_copy_of_insn_rtx (rtx insn_rtx)
 {
 rtx
 create_copy_of_insn_rtx (rtx insn_rtx)
 {
-  rtx res;
+  rtx res, link;
 
   if (DEBUG_INSN_P (insn_rtx))
     return create_insn_rtx_from_pattern (copy_rtx (PATTERN (insn_rtx)),
 
   if (DEBUG_INSN_P (insn_rtx))
     return create_insn_rtx_from_pattern (copy_rtx (PATTERN (insn_rtx)),
@@ -5733,6 +5733,22 @@ create_copy_of_insn_rtx (rtx insn_rtx)
 
   res = create_insn_rtx_from_pattern (copy_rtx (PATTERN (insn_rtx)),
                                       NULL_RTX);
 
   res = create_insn_rtx_from_pattern (copy_rtx (PATTERN (insn_rtx)),
                                       NULL_RTX);
+
+  /* Copy all REG_NOTES except REG_EQUAL/REG_EQUIV and REG_LABEL_OPERAND
+     since mark_jump_label will make them.  REG_LABEL_TARGETs are created
+     there too, but are supposed to be sticky, so we copy them.  */
+  for (link = REG_NOTES (insn_rtx); link; link = XEXP (link, 1))
+    if (REG_NOTE_KIND (link) != REG_LABEL_OPERAND
+       && REG_NOTE_KIND (link) != REG_EQUAL
+       && REG_NOTE_KIND (link) != REG_EQUIV)
+      {
+       if (GET_CODE (link) == EXPR_LIST)
+         add_reg_note (res, REG_NOTE_KIND (link),
+                       copy_insn_1 (XEXP (link, 0)));
+       else
+         add_reg_note (res, REG_NOTE_KIND (link), XEXP (link, 0));
+      }
+
   return res;
 }
 
   return res;
 }
 
index 21b44c6..86a3311 100644 (file)
@@ -1,3 +1,8 @@
+2011-12-16  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/51557
+       * gcc.dg/pr51557.c: New test.
+
 2011-12-16  Richard Guenther  <rguenther@suse.de>
 
        PR lto/51572
 2011-12-16  Richard Guenther  <rguenther@suse.de>
 
        PR lto/51572
diff --git a/gcc/testsuite/gcc.dg/pr51557.c b/gcc/testsuite/gcc.dg/pr51557.c
new file mode 100644 (file)
index 0000000..692cd00
--- /dev/null
@@ -0,0 +1,17 @@
+/* PR debug/51557 */
+/* { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } } */
+/* { dg-options "-Os -fno-asynchronous-unwind-tables -g -fsel-sched-pipelining -fselective-scheduling2" } */
+
+extern int baz (void);
+extern void bar (int, int, int, int, int, int, int);
+
+void
+synth (int *values, int n_values, int ci, int s1, int v, int s2)
+{
+  while (--s1)
+    {
+      int r1 = values[s1];
+      int co = ci ? r1 : baz () < r1;
+      bar (0, n_values, s1, s2, v, co, 0);
+    }
+}