aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-11-06 09:28:37 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2007-11-06 09:28:37 +0100
commitc563bcd1da29d2a3a107e39eb894427042df5973 (patch)
tree030694814e60861497889441b31cf23e74609662
parent239371f9c700813d7e7be7f34959850bd36a720f (diff)
downloadgcc-c563bcd1da29d2a3a107e39eb894427042df5973.zip
gcc-c563bcd1da29d2a3a107e39eb894427042df5973.tar.gz
gcc-c563bcd1da29d2a3a107e39eb894427042df5973.tar.bz2
re PR tree-optimization/33993 (ICE: verify_stmts failed (invalid reference prefix))
PR tree-optimization/33993 * tree-vect-transform.c (vect_get_constant_vectors): Use build_vector rather than build_constructor_from_list if all list values are constants. (get_initial_def_for_induction): Use build_vector instead of build_constructor_from_list. * gcc.c-torture/compile/20071105-1.c: New test. From-SVN: r129920
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20071105-1.c11
-rw-r--r--gcc/tree-vect-transform.c16
4 files changed, 38 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b9d370e..38237bf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2007-11-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/33993
+ * tree-vect-transform.c (vect_get_constant_vectors): Use build_vector
+ rather than build_constructor_from_list if all list values are
+ constants.
+ (get_initial_def_for_induction): Use build_vector instead of
+ build_constructor_from_list.
+
2007-11-05 Mark Mitchell <mark@codesourcery.com>
PR target/33579
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e08a6f3..54974ac 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2007-11-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/33993
+ * gcc.c-torture/compile/20071105-1.c: New test.
+
2007-11-05 Jakub Jelinek <jakub@redhat.com>
PR rtl-optimization/33648
diff --git a/gcc/testsuite/gcc.c-torture/compile/20071105-1.c b/gcc/testsuite/gcc.c-torture/compile/20071105-1.c
new file mode 100644
index 0000000..952b1bd
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20071105-1.c
@@ -0,0 +1,11 @@
+/* PR tree-optimization/33993 */
+/* Testcase by Martin Michlmayr <tbm@cyrius.com> */
+
+void
+init_full (char *array, int ny)
+{
+ int j;
+ char acc = 128;
+ for (j = 0; j < ny; j++)
+ *array++ = acc++;
+}
diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c
index 2cdc79b..736f0c9 100644
--- a/gcc/tree-vect-transform.c
+++ b/gcc/tree-vect-transform.c
@@ -1318,6 +1318,7 @@ vect_get_constant_vectors (slp_tree slp_node, VEC(tree,heap) **vec_oprnds,
bool is_store = false;
unsigned int number_of_vectors = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node);
VEC (tree, heap) *voprnds = VEC_alloc (tree, heap, number_of_vectors);
+ bool constant_p;
if (STMT_VINFO_DATA_REF (stmt_vinfo))
is_store = true;
@@ -1341,6 +1342,7 @@ vect_get_constant_vectors (slp_tree slp_node, VEC(tree,heap) **vec_oprnds,
number_of_copies = least_common_multiple (nunits, group_size) / group_size;
number_of_places_left_in_vector = nunits;
+ constant_p = true;
for (j = 0; j < number_of_copies; j++)
{
for (i = group_size - 1; VEC_iterate (tree, stmts, i, stmt); i--)
@@ -1350,6 +1352,8 @@ vect_get_constant_vectors (slp_tree slp_node, VEC(tree,heap) **vec_oprnds,
op = operation;
else
op = TREE_OPERAND (operation, op_num);
+ if (!CONSTANT_CLASS_P (op))
+ constant_p = false;
/* Create 'vect_ = {op0,op1,...,opn}'. */
t = tree_cons (NULL_TREE, op, t);
@@ -1362,7 +1366,11 @@ vect_get_constant_vectors (slp_tree slp_node, VEC(tree,heap) **vec_oprnds,
vector_type = get_vectype_for_scalar_type (TREE_TYPE (op));
gcc_assert (vector_type);
- vec_cst = build_constructor_from_list (vector_type, t);
+ if (constant_p)
+ vec_cst = build_vector (vector_type, t);
+ else
+ vec_cst = build_constructor_from_list (vector_type, t);
+ constant_p = true;
VEC_quick_push (tree, voprnds,
vect_init_vector (stmt, vec_cst, vector_type,
NULL));
@@ -1617,7 +1625,8 @@ get_initial_def_for_induction (tree iv_phi)
t = NULL_TREE;
for (i = 0; i < nunits; i++)
t = tree_cons (NULL_TREE, unshare_expr (new_name), t);
- vec = build_constructor_from_list (vectype, t);
+ gcc_assert (CONSTANT_CLASS_P (new_name));
+ vec = build_vector (vectype, t);
vec_step = vect_init_vector (iv_phi, vec, vectype, NULL);
@@ -1673,7 +1682,8 @@ get_initial_def_for_induction (tree iv_phi)
t = NULL_TREE;
for (i = 0; i < nunits; i++)
t = tree_cons (NULL_TREE, unshare_expr (new_name), t);
- vec = build_constructor_from_list (vectype, t);
+ gcc_assert (CONSTANT_CLASS_P (new_name));
+ vec = build_vector (vectype, t);
vec_step = vect_init_vector (iv_phi, vec, vectype, NULL);
vec_def = induc_def;