diff mbox

Fix PR tree-optimization/51015

Message ID CAKSNEw6F4YrQr6AcGMe64zq+EKjnCZJ+bcQHiERGgPmT4-y8BQ@mail.gmail.com
State New
Headers show

Commit Message

Ira Rosen Nov. 9, 2011, 6:42 a.m. UTC
Hi,

Some of the recently added vectorizer pattern detection functions
create pattern def stmts, and set vectype for these statements. This
causes an assert failure in vect_determine_vectorization_factor, since
we only expect data-refs and pattern statements themselves to have the
vectype set. This patch updates the assert.

Bootstrapped on powerpc64-suse-linux and tested on
powerpc64-suse-linux and x86_64-suse-linux.
Committed.

Ira

ChangeLog:

        PR tree-optimization/51015
        * tree-vect-loop.c (vect_determine_vectorization_factor): Expect
        vectype to be set for pattern def stmts.

testsuite/ChangeLog:

        PR tree-optimization/51015
        * gcc.dg/vect/pr51015.c: New test.

+/* { dg-final { cleanup-tree-dump "vect" } } */
diff mbox

Patch

Index: tree-vect-loop.c
===================================================================
--- tree-vect-loop.c    (revision 181159)
+++ tree-vect-loop.c    (working copy)
@@ -342,10 +342,12 @@  vect_determine_vectorization_factor (loop_vec_info
          if (STMT_VINFO_VECTYPE (stmt_info))
            {
              /* The only case when a vectype had been already set is for stmts
-                that contain a dataref, or for "pattern-stmts" (stmts generated
-                by the vectorizer to represent/replace a certain idiom).  */
+                that contain a dataref, or for "pattern-stmts" (stmts
+                generated by the vectorizer to represent/replace a certain
+                idiom).  */
              gcc_assert (STMT_VINFO_DATA_REF (stmt_info)
-                         || is_pattern_stmt_p (stmt_info));
+                         || is_pattern_stmt_p (stmt_info)
+                         || pattern_def);
              vectype = STMT_VINFO_VECTYPE (stmt_info);
            }
          else
Index: testsuite/gcc.dg/vect/pr51015.c
===================================================================
--- testsuite/gcc.dg/vect/pr51015.c     (revision 0)
+++ testsuite/gcc.dg/vect/pr51015.c     (revision 0)
@@ -0,0 +1,19 @@ 
+/* { dg-do compile } */
+
+typedef unsigned long long __u64;
+static __u64 ext2_max_sizes[16 - 10 + 1];
+
+void e2fsck_pass1()
+{
+ int i;
+ __u64 max_sizes;
+
+ for (i = 10; i <= 16; i++) {
+  max_sizes = 12 + (1ULL << ((i) - 2));
+  max_sizes = max_sizes + (1ULL << ((i) - 2)) * (1ULL << ((i) - 2));
+  max_sizes = max_sizes + (1ULL << ((i) - 2)) * (1ULL << ((i) - 2)) *
(1ULL <<((i) - 2));
+  ext2_max_sizes[i - 10] = max_sizes;
+ }
+}
+