public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, haifa-sched]: Fix PR56023, -fcompare-debug failure due to sched1 pass on 4.6 branch
@ 2013-01-19 19:57 Uros Bizjak
  2013-01-21 12:27 ` [PATCH v2, " Uros Bizjak
  2013-01-21 14:39 ` [PATCH, " Vladimir Makarov
  0 siblings, 2 replies; 4+ messages in thread
From: Uros Bizjak @ 2013-01-19 19:57 UTC (permalink / raw)
  To: gcc-patches; +Cc: Raúl Porcel

[-- Attachment #1: Type: text/plain, Size: 790 bytes --]

Hello!

We should not update ticks of instructions, dependent on debug
instruction. Without the patch, the scheduling order depends on the
presence of debug instructions and leads to -fcompare-debug failures.

2012-01-19  Uros Bizjak  <ubizjak@gmail.com>

	PR rtl-optimization/56023
	* haifa-sched.c (fix_inter_tick): Do not update ticks of instructions,
	dependent on debug instruction.

testsuite/ChangeLog:

2012-01-19  Uros Bizjak  <ubizjak@gmail.com>

	PR rtl-optimization/56023
	* gcc.dg/pr56023.c: New test.

Tested on 4.6 branch on alpha-linux-gnu, where it fixes the bootstrap
failure and x86_64-pc-linux-gnu {,-m32}.

The patch should be applied to 4.7 and 4.8 branches as well. Patch was
also tested on mainline x86_64-pc-linux-gnu {,-m32}.

OK for 4.6, 4.7 and mainline?

Uros.

[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 919 bytes --]

Index: haifa-sched.c
===================================================================
--- haifa-sched.c	(revision 195276)
+++ haifa-sched.c	(working copy)
@@ -3684,6 +3684,9 @@ fix_inter_tick (rtx head, rtx tail)
 	      INSN_TICK (head) = tick;
 	    }
 
+	  if (DEBUG_INSN_P (head))
+	    continue;
+
 	  FOR_EACH_DEP (head, SD_LIST_RES_FORW, sd_it, dep)
 	    {
 	      rtx next;
Index: testsuite/gcc.dg/pr56023.c
===================================================================
--- testsuite/gcc.dg/pr56023.c	(revision 0)
+++ testsuite/gcc.dg/pr56023.c	(working copy)
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fcompare-debug" } */
+
+void
+foo (char *c)
+{
+  unsigned int x = 0;
+  unsigned int i;
+
+  for (i = 0; c[i]; i++)
+    {
+      if (i >= 5 && x != 1)
+	break;
+      else if (c[i] == ' ')
+	x = i;
+      else if (c[i] == '/' && c[i + 1] != ' ' && i)
+	x = i + 1;
+    }
+}

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2, haifa-sched]: Fix PR56023, -fcompare-debug failure due to sched1 pass on 4.6 branch
  2013-01-19 19:57 [PATCH, haifa-sched]: Fix PR56023, -fcompare-debug failure due to sched1 pass on 4.6 branch Uros Bizjak
@ 2013-01-21 12:27 ` Uros Bizjak
  2013-01-21 17:37   ` Uros Bizjak
  2013-01-21 14:39 ` [PATCH, " Vladimir Makarov
  1 sibling, 1 reply; 4+ messages in thread
From: Uros Bizjak @ 2013-01-21 12:27 UTC (permalink / raw)
  To: gcc-patches; +Cc: Raúl Porcel

[-- Attachment #1: Type: text/plain, Size: 1130 bytes --]

On Sat, Jan 19, 2013 at 8:57 PM, Uros Bizjak <ubizjak@gmail.com> wrote:

> We should not update ticks of instructions, dependent on debug
> instruction. Without the patch, the scheduling order depends on the
> presence of debug instructions and leads to -fcompare-debug failures.

Attached patch refines previous patch to reject only cases where
non-debug insns depend on debug instructions. We can still fix
inter-ticks of dependent debug insns, without affecting emitted
real-insn sequences.

2012-01-21  Uros Bizjak  <ubizjak@gmail.com>

        PR rtl-optimization/56023
        * haifa-sched.c (fix_inter_tick): Do not update ticks of non-debug
        instructions, dependent on debug instruction.

testsuite/ChangeLog:

2012-01-21  Uros Bizjak  <ubizjak@gmail.com>

        PR rtl-optimization/56023
        * gcc.dg/pr56023.c: New test.


Re-tested on 4.6 branch on alpha-linux-gnu, where it fixes the
bootstrap failure and on x86_64-pc-linux-gnu {,-m32}.

The patch should be applied to 4.7 and 4.8 branches as well. Patch was
also re-tested on mainline x86_64-pc-linux-gnu {,-m32}.

OK for 4.6, 4.7 and mainline?

Uros.

[-- Attachment #2: r.diff.txt --]
[-- Type: text/plain, Size: 505 bytes --]

Index: haifa-sched.c
===================================================================
--- haifa-sched.c	(revision 195330)
+++ haifa-sched.c	(working copy)
@@ -3686,9 +3686,11 @@ fix_inter_tick (rtx head, rtx tail)
 
 	  FOR_EACH_DEP (head, SD_LIST_RES_FORW, sd_it, dep)
 	    {
-	      rtx next;
+	      rtx next = DEP_CON (dep);
 
-	      next = DEP_CON (dep);
+	      if (DEBUG_INSN_P (head) && !DEBUG_INSN_P (next))
+		continue;
+
 	      tick = INSN_TICK (next);
 
 	      if (tick != INVALID_TICK

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH, haifa-sched]: Fix PR56023, -fcompare-debug failure due to sched1 pass on 4.6 branch
  2013-01-19 19:57 [PATCH, haifa-sched]: Fix PR56023, -fcompare-debug failure due to sched1 pass on 4.6 branch Uros Bizjak
  2013-01-21 12:27 ` [PATCH v2, " Uros Bizjak
@ 2013-01-21 14:39 ` Vladimir Makarov
  1 sibling, 0 replies; 4+ messages in thread
From: Vladimir Makarov @ 2013-01-21 14:39 UTC (permalink / raw)
  To: Uros Bizjak; +Cc: gcc-patches, Raúl Porcel

On 13-01-19 2:57 PM, Uros Bizjak wrote:
> Hello!
>
> We should not update ticks of instructions, dependent on debug
> instruction. Without the patch, the scheduling order depends on the
> presence of debug instructions and leads to -fcompare-debug failures.
>
> 2012-01-19  Uros Bizjak  <ubizjak@gmail.com>
>
> 	PR rtl-optimization/56023
> 	* haifa-sched.c (fix_inter_tick): Do not update ticks of instructions,
> 	dependent on debug instruction.
>
> testsuite/ChangeLog:
>
> 2012-01-19  Uros Bizjak  <ubizjak@gmail.com>
>
> 	PR rtl-optimization/56023
> 	* gcc.dg/pr56023.c: New test.
>
> Tested on 4.6 branch on alpha-linux-gnu, where it fixes the bootstrap
> failure and x86_64-pc-linux-gnu {,-m32}.
>
> The patch should be applied to 4.7 and 4.8 branches as well. Patch was
> also tested on mainline x86_64-pc-linux-gnu {,-m32}.
>
> OK for 4.6, 4.7 and mainline?
>
Ok. Thanks for working on this, Uros.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2, haifa-sched]: Fix PR56023, -fcompare-debug failure due to sched1 pass on 4.6 branch
  2013-01-21 12:27 ` [PATCH v2, " Uros Bizjak
@ 2013-01-21 17:37   ` Uros Bizjak
  0 siblings, 0 replies; 4+ messages in thread
From: Uros Bizjak @ 2013-01-21 17:37 UTC (permalink / raw)
  To: gcc-patches; +Cc: Raúl Porcel, Vladimir Makarov

On Mon, Jan 21, 2013 at 1:27 PM, Uros Bizjak <ubizjak@gmail.com> wrote:

>> We should not update ticks of instructions, dependent on debug
>> instruction. Without the patch, the scheduling order depends on the
>> presence of debug instructions and leads to -fcompare-debug failures.
>
> Attached patch refines previous patch to reject only cases where
> non-debug insns depend on debug instructions. We can still fix
> inter-ticks of dependent debug insns, without affecting emitted
> real-insn sequences.

FTR, from offline discussion with Vlad, setting ticks of debug
instructions is not necessary (and just wastes cycles), so I will
commit version 1 of the patch.

Uros.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-01-21 17:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-19 19:57 [PATCH, haifa-sched]: Fix PR56023, -fcompare-debug failure due to sched1 pass on 4.6 branch Uros Bizjak
2013-01-21 12:27 ` [PATCH v2, " Uros Bizjak
2013-01-21 17:37   ` Uros Bizjak
2013-01-21 14:39 ` [PATCH, " Vladimir Makarov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).