Patchwork [committed] Fix MASK_{LOAD,STORE} caused ICE (PR tree-optimization/59523)

login
register
mail settings
Submitter Jakub Jelinek
Date Dec. 17, 2013, 9:37 p.m.
Message ID <20131217213757.GT892@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/302517/
State New
Headers show

Comments

Jakub Jelinek - Dec. 17, 2013, 9:37 p.m.
Hi!

I forgot to update_stmt stmts I've changed.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
committed to trunk as obvious.

2013-12-17  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/59523
	* tree-vectorizer.c (fold_loop_vectorized_call): Call update_stmt
	on updated stmts.

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


	Jakub
H.J. Lu - Dec. 24, 2013, 12:25 p.m.
On Tue, Dec 17, 2013 at 1:37 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> I forgot to update_stmt stmts I've changed.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
> committed to trunk as obvious.
>
> 2013-12-17  Jakub Jelinek  <jakub@redhat.com>
>
>         PR tree-optimization/59523
>         * tree-vectorizer.c (fold_loop_vectorized_call): Call update_stmt
>         on updated stmts.

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59591

Patch

--- gcc/tree-vectorizer.c.jj	2013-12-10 12:43:21.000000000 +0100
+++ gcc/tree-vectorizer.c	2013-12-17 16:54:27.584080849 +0100
@@ -369,8 +369,11 @@  fold_loop_vectorized_call (gimple g, tre
 
   update_call_from_tree (&gsi, value);
   FOR_EACH_IMM_USE_STMT (use_stmt, iter, lhs)
-    FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
-      SET_USE (use_p, value);
+    {
+      FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
+	SET_USE (use_p, value);
+      update_stmt (use_stmt);
+    }
 }
 
 /* Function vectorize_loops.
--- gcc/testsuite/gcc.dg/pr59523.c.jj	2013-12-17 16:58:35.706806284 +0100
+++ gcc/testsuite/gcc.dg/pr59523.c	2013-12-17 16:58:23.000000000 +0100
@@ -0,0 +1,17 @@ 
+/* PR tree-optimization/59523 */
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+/* { dg-additional-options "-mavx2" { target { i?86-*-* x86_64-*-* } } } */
+
+int *
+foo (int a, int *b, int *c, int *d)
+{
+  int i, *r = __builtin_alloca (a * sizeof (int));
+  __builtin_memcpy (r, d, a * sizeof (int));
+  for (i = 0; i < 64; i++)
+    c[i] += b[i];
+  for (i = 0; i < a; i++)
+    if (r[i] == 0)
+      r[i] = 1;
+  return r;
+}