This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix VTA ICE with -fmodulo-sched (PR debug/42244)


Hi!

The following testcase ICEs on powerpc-linux, because create_ddg_dep_no_link
is called with a DEBUG_INSN, but non-ANTI_DEP d_t.  DEBUG_INSNs must use
ANTI_DEP, otherwise they would affect code generation.  Fixed thusly,
bootstrapped/regtested on x86_64-linux and powerpc64-linux
(--with-cpu=default32, but -m32/-m64 testing).
Alex made a similar change in PR41535 in a different spot.

Ok for trunk?

2009-12-03  Jakub Jelinek  <jakub@redhat.com>

	PR debug/42244
	* ddg.c (add_inter_loop_mem_dep): Use ANTI_DEP if from or to
	is a DEBUG_INSN.

	* gcc.dg/debug/pr42244.c: New test.

--- gcc/ddg.c.jj	2009-11-25 16:47:35.000000000 +0100
+++ gcc/ddg.c	2009-12-03 14:49:40.000000000 +0100
@@ -359,9 +359,13 @@ add_inter_loop_mem_dep (ddg_ptr g, ddg_n
   if (mem_write_insn_p (from->insn))
     {
       if (mem_read_insn_p (to->insn))
-  	create_ddg_dep_no_link (g, from, to, TRUE_DEP, MEM_DEP, 1);
+  	create_ddg_dep_no_link (g, from, to,
+				DEBUG_INSN_P (to->insn)
+				? ANTI_DEP : TRUE_DEP, MEM_DEP, 1);
       else if (from->cuid != to->cuid)
-  	create_ddg_dep_no_link (g, from, to, OUTPUT_DEP, MEM_DEP, 1);
+  	create_ddg_dep_no_link (g, from, to,
+				DEBUG_INSN_P (to->insn)
+				? ANTI_DEP : OUTPUT_DEP, MEM_DEP, 1);
     }
   else
     {
@@ -369,8 +373,11 @@ add_inter_loop_mem_dep (ddg_ptr g, ddg_n
 	return;
       else if (from->cuid != to->cuid)
 	{
-  	  create_ddg_dep_no_link (g, from, to, ANTI_DEP, MEM_DEP, 1);
-  	  create_ddg_dep_no_link (g, to, from, TRUE_DEP, MEM_DEP, 1);
+	  create_ddg_dep_no_link (g, from, to, ANTI_DEP, MEM_DEP, 1);
+	  if (DEBUG_INSN_P (from->insn) || DEBUG_INSN_P (to->insn))
+	    create_ddg_dep_no_link (g, to, from, ANTI_DEP, MEM_DEP, 1);
+	  else
+	    create_ddg_dep_no_link (g, to, from, TRUE_DEP, MEM_DEP, 1);
 	}
     }
 
--- gcc/testsuite/gcc.dg/debug/pr42244.c.jj	2009-12-03 14:51:58.000000000 +0100
+++ gcc/testsuite/gcc.dg/debug/pr42244.c	2009-12-03 14:51:18.000000000 +0100
@@ -0,0 +1,13 @@
+/* PR debug/42444 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -g -fmodulo-sched -ffloat-store" } */
+
+extern int a, b;
+
+double
+foo (double x)
+{
+  for (; a > b; a--)
+    x *= (double) a;
+  return x;
+}

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]