+2012-03-16 Richard Guenther <rguenther@suse.de>
+
+ * tree-vect-loop.c (get_initial_def_for_induction): Use
+ build_constructor directly.
+ * tree-vect-stmts.c (vect_get_vec_def_for_operand): Use
+ build_vector_from_val.
+ * tree.c (build_vector_from_val): Avoid creating a constructor
+ first when we want a constant vector.
+
2012-03-16 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* doc/install.texi (Specific, *-*-solaris2*): Improve wording.
}
else
{
+ VEC(constructor_elt,gc) *v;
+
/* iv_loop is the loop to be vectorized. Create:
vec_init = [X, X+S, X+2*S, X+3*S] (S = step_expr, X = init_expr) */
new_var = vect_get_new_vect_var (scalar_type, vect_scalar_var, "var_");
gcc_assert (!new_bb);
}
- t = NULL_TREE;
- t = tree_cons (NULL_TREE, new_name, t);
+ v = VEC_alloc (constructor_elt, gc, nunits);
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, new_name);
for (i = 1; i < nunits; i++)
{
/* Create: new_name_i = new_name + step_expr */
fprintf (vect_dump, "created new init_stmt: ");
print_gimple_stmt (vect_dump, init_stmt, 0, TDF_SLIM);
}
- t = tree_cons (NULL_TREE, new_name, t);
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, new_name);
}
/* Create a vector from [new_name_0, new_name_1, ..., new_name_nunits-1] */
- vec = build_constructor_from_list (vectype, nreverse (t));
+ vec = build_constructor (vectype, v);
vec_init = vect_init_vector (iv_phi, vec, vectype, NULL);
}
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo);
tree vec_inv;
tree vec_cst;
- tree t = NULL_TREE;
tree def;
- int i;
enum vect_def_type dt;
bool is_simple_use;
tree vector_type;
{
vector_type = get_vectype_for_scalar_type (TREE_TYPE (def));
gcc_assert (vector_type);
- nunits = TYPE_VECTOR_SUBPARTS (vector_type);
if (scalar_def)
*scalar_def = def;
if (vect_print_dump_info (REPORT_DETAILS))
fprintf (vect_dump, "Create vector_inv.");
- for (i = nunits - 1; i >= 0; --i)
- {
- t = tree_cons (NULL_TREE, def, t);
- }
-
- /* FIXME: use build_constructor directly. */
- vec_inv = build_constructor_from_list (vector_type, t);
+ vec_inv = build_vector_from_val (vector_type, def);
return vect_init_vector (stmt, vec_inv, vector_type, NULL);
}
build_vector_from_val (tree vectype, tree sc)
{
int i, nunits = TYPE_VECTOR_SUBPARTS (vectype);
- VEC(constructor_elt, gc) *v = NULL;
if (sc == error_mark_node)
return sc;
gcc_checking_assert (types_compatible_p (TYPE_MAIN_VARIANT (TREE_TYPE (sc)),
TREE_TYPE (vectype)));
- v = VEC_alloc (constructor_elt, gc, nunits);
- for (i = 0; i < nunits; ++i)
- CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, sc);
-
if (CONSTANT_CLASS_P (sc))
- return build_vector_from_ctor (vectype, v);
- else
- return build_constructor (vectype, v);
+ {
+ tree *v = XALLOCAVEC (tree, nunits);
+ for (i = 0; i < nunits; ++i)
+ v[i] = sc;
+ return build_vector (vectype, v);
+ }
+ else
+ {
+ VEC(constructor_elt, gc) *v = VEC_alloc (constructor_elt, gc, nunits);
+ for (i = 0; i < nunits; ++i)
+ CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, sc);
+ return build_constructor (vectype, v);
+ }
}
/* Return a new CONSTRUCTOR node whose type is TYPE and whose values