Patchwork [haifa-sched] : Fix PR56023, -fcompare-debug failure due to sched1 pass on 4.6 branch

login
register
mail settings
Submitter Uros Bizjak
Date Jan. 19, 2013, 7:57 p.m.
Message ID <CAFULd4ae3+W4O6o8896EsEjEk2pagFu_ryQJRcdg4nRYUKqg5A@mail.gmail.com>
Download mbox | patch
Permalink /patch/213882/
State New
Headers show

Comments

Uros Bizjak - Jan. 19, 2013, 7:57 p.m.
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.
Vladimir Makarov - Jan. 21, 2013, 2:31 p.m.
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.

Patch

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;
+    }
+}