]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/37174 (ICE: in vinfo_for_stmt, at tree-vectorizer.h:546)
authorIra Rosen <irar@il.ibm.com>
Sat, 23 Aug 2008 10:42:34 +0000 (10:42 +0000)
committerIra Rosen <irar@gcc.gnu.org>
Sat, 23 Aug 2008 10:42:34 +0000 (10:42 +0000)
PR tree-optimization/37174
* tree-vect-analyze.c (vect_get_and_check_slp_defs): Check that the
def stmt is a part of the loop before accessing its stmt_vec_info.

From-SVN: r139508

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/vect/pr37174.cc [new file with mode: 0644]
gcc/tree-vect-analyze.c

index 69227927ca6b5fa522dec38bb15d359a5c5da7e9..06707dd562ae93407c7585f7f58d0f6da4e2aee2 100644 (file)
@@ -1,3 +1,9 @@
+2008-08-23  Ira Rosen  <irar@il.ibm.com>
+
+       PR tree-optimization/37174
+       * tree-vect-analyze.c (vect_get_and_check_slp_defs): Check that the
+       def stmt is a part of the loop before accessing its stmt_vec_info.
+
 2008-08-22  Anatoly Sokolov  <aesok@post.ru>
 
        PR target/11259
index aca1340dab3edd7b81b7a318ba725e5fd8ca1b2e..38b9dab478992e8169dd7b74f6cf8e2b8ed81d6f 100644 (file)
@@ -1,3 +1,8 @@
+2008-08-23  Ira Rosen  <irar@il.ibm.com>
+
+       PR tree-optimization/37174
+       * g++.dg/vect/pr37174.cc: New test.
+
 2008-08-22  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/37078
diff --git a/gcc/testsuite/g++.dg/vect/pr37174.cc b/gcc/testsuite/g++.dg/vect/pr37174.cc
new file mode 100644 (file)
index 0000000..d720e4b
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+int* getFoo();
+struct Bar {
+        Bar();
+        int* foo1;
+        int* foo2;
+        int* table[4][4][4];
+};
+Bar::Bar() {
+        foo1 = getFoo();
+        foo2 = getFoo();
+        for (int a = 0; a < 4; ++a) {
+                for (int b = 0; b < 4; ++b) {
+                        for (int c = 0; c < 4; ++c) {
+                                table[a][b][c] = foo1;
+                        }
+                }
+        }
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
+
index fcb9cbd5a24235fdf37037881a42dc4b02fdd3c0..0f2efd85ed526ca491258a5a232ad94b7878de70 100644 (file)
@@ -2508,6 +2508,7 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, slp_tree slp_node,
   stmt_vec_info stmt_info = 
     vinfo_for_stmt (VEC_index (gimple, SLP_TREE_SCALAR_STMTS (slp_node), 0));
   enum gimple_rhs_class rhs_class;
+  struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
 
   rhs_class = get_gimple_rhs_class (gimple_assign_rhs_code (stmt));
   number_of_oprnds = gimple_num_ops (stmt) - 1;        /* RHS only */
@@ -2531,7 +2532,9 @@ vect_get_and_check_slp_defs (loop_vec_info loop_vinfo, slp_tree slp_node,
       /* Check if DEF_STMT is a part of a pattern and get the def stmt from
          the pattern. Check that all the stmts of the node are in the
          pattern.  */
-      if (def_stmt && vinfo_for_stmt (def_stmt)
+      if (def_stmt && gimple_bb (def_stmt)
+          && flow_bb_inside_loop_p (loop, gimple_bb (def_stmt))
+          && vinfo_for_stmt (def_stmt)
           && STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (def_stmt)))
         {
           if (!*first_stmt_dt0)