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  <ja...@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.

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

        Jakub

Reply via email to