diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a6beced8011..e7c89c0f4bd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2007-03-17 Dorit Nuzman + + PR tree-optimization/31041 + * tree-vect-transform.c (get_initial_def_for_induction): Call + force_gimple_operand. + 2007-03-17 Olga Golovanevsky * ipa-type-escape.c (look_for_casts) : Revert code to use diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 560fab9262d..478aa77606d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-03-17 Dorit Nuzman + + PR tree-optimization/31041 + * gcc.dg/vect/pr31041.c: New test. + 2007-03-16 Manuel Lopez-Ibanez * g++.dg/warn/Wconversion-integer.C: New diff --git a/gcc/testsuite/gcc.dg/vect/pr31041.c b/gcc/testsuite/gcc.dg/vect/pr31041.c new file mode 100644 index 00000000000..e2b0b636e42 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr31041.c @@ -0,0 +1,27 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_int } */ + +#include +#include "tree-vect.h" + +typedef int int32_t; +struct UNewTrie +{ + int32_t index[(0x110000 >> 1)]; +}; +typedef struct UNewTrie UNewTrie; +utrie_open_3_4 () +{ + UNewTrie *trie; + int32_t i, j; + { + i = 0; + do + { + trie->index[i++] = j; + j += 1; + } + while (i < 5); + } +} +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c index 6938841628d..bddea1e5dc2 100644 --- a/gcc/tree-vect-transform.c +++ b/gcc/tree-vect-transform.c @@ -548,6 +548,7 @@ get_initial_def_for_induction (tree stmt, tree iv_phi) int ncopies = vf / nunits; tree expr; stmt_vec_info phi_info = vinfo_for_stmt (iv_phi); + tree stmts; gcc_assert (phi_info); @@ -575,16 +576,23 @@ get_initial_def_for_induction (tree stmt, tree iv_phi) gcc_assert (ok); /* Create the vector that holds the initial_value of the induction. */ - new_name = init_expr; + new_var = vect_get_new_vect_var (scalar_type, vect_scalar_var, "var_"); + add_referenced_var (new_var); + + new_name = force_gimple_operand (init_expr, &stmts, false, new_var); + if (stmts) + { + new_bb = bsi_insert_on_edge_immediate (pe, stmts); + gcc_assert (!new_bb); + } + t = NULL_TREE; - t = tree_cons (NULL_TREE, init_expr, t); + t = tree_cons (NULL_TREE, new_name, t); for (i = 1; i < nunits; i++) { tree tmp; /* Create: new_name = new_name + step_expr */ - new_var = vect_get_new_vect_var (scalar_type, vect_scalar_var, "var_"); - add_referenced_var (new_var); tmp = fold_build2 (PLUS_EXPR, scalar_type, new_name, step_expr); init_stmt = build_gimple_modify_stmt (new_var, tmp); new_name = make_ssa_name (new_var, init_stmt);