re PR middle-end/37174 (ICE: in vinfo_for_stmt, at tree-vectorizer.h:546)

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
This commit is contained in:
Ira Rosen 2008-08-23 10:42:34 +00:00 committed by Ira Rosen
parent ae96d86a55
commit f5d3c7e14e
4 changed files with 38 additions and 1 deletions

View 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

View 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

View File

@ -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" } } */

View 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)