Hi!

This patch removes a bogus assertion (that predates introduction
of STMT_VINFO_PATTERN_DEF_SEQ (and STMT_VINFO_PATTERN_DEF_STMT
before that) in 4.7).  stmt might be not just STMT_VINFO_RELATED_STMT
of orig_stmt, bt also could be anywhere in STMT_VINFO_PATTERN_DEF_SEQ
of it.  We don't vectorize this anyway for multiple reasons (e.g.
orig_code is TRUNC_DIV_EXPR which isn't handled reduction code,
and even the pattern recognized stmts include MULT_HIGHPART_EXPR
which isn't handled either).

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

2012-11-27  Jakub Jelinek  <ja...@redhat.com>

        PR tree-optimization/55110
        * tree-vect-loop.c (vectorizable_reduction): Don't assert
        that STMT_VINFO_RELATED_STMT of orig_stmt is stmt.

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

--- gcc/tree-vect-loop.c.jj     2012-11-21 16:00:12.000000000 +0100
+++ gcc/tree-vect-loop.c        2012-11-26 11:24:42.903995009 +0100
@@ -4624,7 +4624,6 @@ vectorizable_reduction (gimple stmt, gim
   if (orig_stmt)
     {
       orig_stmt_info = vinfo_for_stmt (orig_stmt);
-      gcc_assert (STMT_VINFO_RELATED_STMT (orig_stmt_info) == stmt);
       gcc_assert (STMT_VINFO_IN_PATTERN_P (orig_stmt_info));
       gcc_assert (!STMT_VINFO_IN_PATTERN_P (stmt_info));
     }
--- gcc/testsuite/gcc.dg/pr55110.c.jj   2012-11-26 11:31:32.008587313 +0100
+++ gcc/testsuite/gcc.dg/pr55110.c      2012-11-26 11:31:09.000000000 +0100
@@ -0,0 +1,13 @@
+/* PR tree-optimization/55110 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftree-vectorize" } */
+
+int
+foo (int x)
+{
+  int a, b;
+  for (b = 0; b < 8; b++)
+    for (a = 0; a < 2; a++)
+      x /= 3;
+  return x;
+}

        Jakub

Reply via email to