public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix a -fcompare-debug bug in the vectorizer (PR debug/49496)
@ 2011-06-22 17:19 Jakub Jelinek
  2011-06-22 18:12 ` Richard Guenther
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2011-06-22 17:19 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ira Rosen

Hi!

This bug has been introduced recently, we shouldn't take debug uses into
account when deciding whether to optimize.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2011-06-22  Jakub Jelinek  <jakub@redhat.com>

	PR debug/49496
	* tree-vect-patterns.c (vect_recog_widen_mult_pattern): Ignore debug
	uses.

	* gcc.dg/pr49496.c: New test.

--- gcc/tree-vect-patterns.c.jj	2011-06-17 11:02:19.000000000 +0200
+++ gcc/tree-vect-patterns.c	2011-06-22 11:23:08.000000000 +0200
@@ -557,6 +557,8 @@ vect_recog_widen_mult_pattern (VEC (gimp
 
       FOR_EACH_IMM_USE_FAST (use_p, imm_iter, lhs)
         {
+	  if (is_gimple_debug (USE_STMT (use_p)))
+	    continue;
           use_stmt = USE_STMT (use_p);
           nuses++;
         }
--- gcc/testsuite/gcc.dg/pr49496.c.jj	2011-06-22 11:24:30.000000000 +0200
+++ gcc/testsuite/gcc.dg/pr49496.c	2011-06-22 11:28:33.000000000 +0200
@@ -0,0 +1,20 @@
+/* PR debug/49496 */
+/* { dg-do compile } */
+/* { dg-options "-O3 -fcompare-debug" } */
+
+unsigned short u[8], s1[8], s2[8];
+
+void bar (unsigned short *);
+
+void
+foo (void)
+{
+  unsigned short e[8];
+  int i;
+  for (i = 0; i < 8; i++)
+    {
+      int tmp = s1[i] * s2[i];
+      e[i] = (tmp & 0xffff0000) >> 16;
+    }
+  bar (e);
+}

	Jakub

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

* Re: [PATCH] Fix a -fcompare-debug bug in the vectorizer (PR debug/49496)
  2011-06-22 17:19 [PATCH] Fix a -fcompare-debug bug in the vectorizer (PR debug/49496) Jakub Jelinek
@ 2011-06-22 18:12 ` Richard Guenther
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Guenther @ 2011-06-22 18:12 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches, Ira Rosen

On Wed, Jun 22, 2011 at 7:02 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> This bug has been introduced recently, we shouldn't take debug uses into
> account when deciding whether to optimize.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Ok.

Thanks,
Richard.

> 2011-06-22  Jakub Jelinek  <jakub@redhat.com>
>
>        PR debug/49496
>        * tree-vect-patterns.c (vect_recog_widen_mult_pattern): Ignore debug
>        uses.
>
>        * gcc.dg/pr49496.c: New test.
>
> --- gcc/tree-vect-patterns.c.jj 2011-06-17 11:02:19.000000000 +0200
> +++ gcc/tree-vect-patterns.c    2011-06-22 11:23:08.000000000 +0200
> @@ -557,6 +557,8 @@ vect_recog_widen_mult_pattern (VEC (gimp
>
>       FOR_EACH_IMM_USE_FAST (use_p, imm_iter, lhs)
>         {
> +         if (is_gimple_debug (USE_STMT (use_p)))
> +           continue;
>           use_stmt = USE_STMT (use_p);
>           nuses++;
>         }
> --- gcc/testsuite/gcc.dg/pr49496.c.jj   2011-06-22 11:24:30.000000000 +0200
> +++ gcc/testsuite/gcc.dg/pr49496.c      2011-06-22 11:28:33.000000000 +0200
> @@ -0,0 +1,20 @@
> +/* PR debug/49496 */
> +/* { dg-do compile } */
> +/* { dg-options "-O3 -fcompare-debug" } */
> +
> +unsigned short u[8], s1[8], s2[8];
> +
> +void bar (unsigned short *);
> +
> +void
> +foo (void)
> +{
> +  unsigned short e[8];
> +  int i;
> +  for (i = 0; i < 8; i++)
> +    {
> +      int tmp = s1[i] * s2[i];
> +      e[i] = (tmp & 0xffff0000) >> 16;
> +    }
> +  bar (e);
> +}
>
>        Jakub
>

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

end of thread, other threads:[~2011-06-22 17:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-22 17:19 [PATCH] Fix a -fcompare-debug bug in the vectorizer (PR debug/49496) Jakub Jelinek
2011-06-22 18:12 ` Richard Guenther

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).