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 -fcompare-debug issue in tree-parloops.c (PR debug/46561)


Hi!

Not ignoring debug stmt imm uses in try_create_reduction_list results
in -fcompare-debug failures.

Bootstrapped/regtested on x86_64-linux and i686-linux, additionally
tested with RUNTESTFLAGS=--target_board=unix/-m64/-fcompare-debug autopar.exp
and similarly for -m32.

Ok for trunk?

2010-11-20  Jakub Jelinek  <jakub@redhat.com>

	PR debug/46561
	* tree-parloops.c (try_create_redunction_list): Ignore debug stmts
	when looking for immediate uses.

	* gcc.dg/autopar/pr46561.c: New test.

--- gcc/tree-parloops.c.jj	2010-11-09 13:58:30.000000000 +0100
+++ gcc/tree-parloops.c	2010-11-19 21:10:29.000000000 +0100
@@ -1870,7 +1870,8 @@ try_create_reduction_list (loop_p loop, 
 	  reduc_phi = NULL;
 	  FOR_EACH_IMM_USE_FAST (use_p, imm_iter, val)
 	    {
-	      if (flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p))))
+	      if (!gimple_debug_bind_p (USE_STMT (use_p))
+		  && flow_bb_inside_loop_p (loop, gimple_bb (USE_STMT (use_p))))
 		{
 		  reduc_phi = USE_STMT (use_p);
 		  break;
--- gcc/testsuite/gcc.dg/autopar/pr46561.c.jj	2010-11-19 21:13:04.000000000 +0100
+++ gcc/testsuite/gcc.dg/autopar/pr46561.c	2010-11-19 21:12:40.000000000 +0100
@@ -0,0 +1,17 @@
+/* PR debug/46561 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-vectorize -ftree-parallelize-loops=2 -fcompare-debug" } */
+
+extern void abort (void);
+
+void foo (char *c)
+{
+  int i;
+  unsigned x = 0;
+  {
+    for (i = 0; i < 64; i += 4)
+	x = x | *((unsigned *) (&c[i]));
+    if (x)
+      abort ();
+  }
+}

	Jakub


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