aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2012-03-16 09:54:36 +0000
committerRichard Guenther <rguenther@suse.de>2012-03-16 09:54:36 +0000
commitc5a7949c357335fe3d5e71ff7285a97076aa1410 (patch)
tree222248ef75fc9b6a3c7c0bfe3657c6acaef2e6b2 /gcc/tree.c
parentbf3833fc4986730c909137100f0bf56a74cb54c2 (diff)
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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@185461 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 1734fc5ed0a..cfea9f7b88d 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1372,7 +1372,6 @@ tree
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;
@@ -1386,14 +1385,20 @@ build_vector_from_val (tree vectype, tree 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