diff mbox

Fix -fcompare-debug issue in tree-parloops.c (PR debug/46561)

Message ID 20101119235228.GL29412@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Nov. 19, 2010, 11:52 p.m. UTC
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.


	Jakub

Comments

Richard Biener Nov. 20, 2010, 10:53 a.m. UTC | #1
On Sat, Nov 20, 2010 at 12:52 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> 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?

Ok.

Thanks,
Richard.

> 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
>
Alexandre Oliva Nov. 24, 2010, 5:14 a.m. UTC | #2
On Nov 19, 2010, Jakub Jelinek <jakub@redhat.com> wrote:

> +	      if (!gimple_debug_bind_p (USE_STMT (use_p))

I'd make this !is_gimple_debug.  It's the same for now, but once other
debug stmts are added, you'll like want to ignore them too.
diff mbox

Patch

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