aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2012-03-26 14:13:35 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2012-03-26 14:13:35 +0000
commit5467ee5255040aee4811c10804c5efc3fdeee4d1 (patch)
tree2f767d40e3eb4f25b25b92c508d91971c9a524bb /gcc
parent39f3fed69d96a818c388450e5141d179ffe310d2 (diff)
downloadgcc-5467ee5255040aee4811c10804c5efc3fdeee4d1.zip
gcc-5467ee5255040aee4811c10804c5efc3fdeee4d1.tar.gz
gcc-5467ee5255040aee4811c10804c5efc3fdeee4d1.tar.bz2
re PR tree-optimization/52721 (segfault in vect_init_vector)
2012-03-26 Richard Guenther <rguenther@suse.de> PR tree-optimization/52721 * tree-vect-stmts.c (vect_init_vector): Handle scalars. From-SVN: r185799
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-vect-stmts.c35
2 files changed, 22 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 04c4ec4..636ef21 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2012-03-26 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/52721
+ * tree-vect-stmts.c (vect_init_vector): Handle scalars.
+
2012-03-26 Ulrich Weigand <ulrich.weigand@linaro.org>
PR tree-optimization/52686
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 3a4d91a..acaf675 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -1142,7 +1142,6 @@ vect_get_load_cost (struct data_reference *dr, int ncopies,
static void
vect_init_vector_1 (gimple stmt, gimple new_stmt, gimple_stmt_iterator *gsi)
{
-
if (gsi)
vect_finish_stmt_generation (stmt, new_stmt, gsi);
else
@@ -1185,48 +1184,48 @@ vect_init_vector_1 (gimple stmt, gimple new_stmt, gimple_stmt_iterator *gsi)
/* Function vect_init_vector.
- Insert a new stmt (INIT_STMT) that initializes a new vector variable with
- the vector elements of VECTOR_VAR. Place the initialization at BSI if it
- is not NULL. Otherwise, place the initialization at the loop preheader.
+ Insert a new stmt (INIT_STMT) that initializes a new variable of type
+ TYPE with the value VAL. If TYPE is a vector type and VAL does not have
+ vector type a vector with all elements equal to VAL is created first.
+ Place the initialization at BSI if it is not NULL. Otherwise, place the
+ initialization at the loop preheader.
Return the DEF of INIT_STMT.
It will be used in the vectorization of STMT. */
tree
-vect_init_vector (gimple stmt, tree vector_var, tree vector_type,
- gimple_stmt_iterator *gsi)
+vect_init_vector (gimple stmt, tree val, tree type, gimple_stmt_iterator *gsi)
{
tree new_var;
gimple init_stmt;
tree vec_oprnd;
tree new_temp;
- if (TREE_CODE (TREE_TYPE (vector_var)) != VECTOR_TYPE)
+ if (TREE_CODE (type) == VECTOR_TYPE
+ && TREE_CODE (TREE_TYPE (val)) != VECTOR_TYPE)
{
- if (!types_compatible_p (TREE_TYPE (vector_type),
- TREE_TYPE (vector_var)))
+ if (!types_compatible_p (TREE_TYPE (type), TREE_TYPE (val)))
{
- if (CONSTANT_CLASS_P (vector_var))
- vector_var = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (vector_type),
- vector_var);
+ if (CONSTANT_CLASS_P (val))
+ val = fold_unary (VIEW_CONVERT_EXPR, TREE_TYPE (type), val);
else
{
- new_var = create_tmp_reg (TREE_TYPE (vector_type), NULL);
+ new_var = create_tmp_reg (TREE_TYPE (type), NULL);
add_referenced_var (new_var);
init_stmt = gimple_build_assign_with_ops (NOP_EXPR,
- new_var, vector_var,
+ new_var, val,
NULL_TREE);
new_temp = make_ssa_name (new_var, init_stmt);
gimple_assign_set_lhs (init_stmt, new_temp);
vect_init_vector_1 (stmt, init_stmt, gsi);
- vector_var = new_temp;
+ val = new_temp;
}
}
- vector_var = build_vector_from_val (vector_type, vector_var);
+ val = build_vector_from_val (type, val);
}
- new_var = vect_get_new_vect_var (vector_type, vect_simple_var, "cst_");
+ new_var = vect_get_new_vect_var (type, vect_simple_var, "cst_");
add_referenced_var (new_var);
- init_stmt = gimple_build_assign (new_var, vector_var);
+ init_stmt = gimple_build_assign (new_var, val);
new_temp = make_ssa_name (new_var, init_stmt);
gimple_assign_set_lhs (init_stmt, new_temp);
vect_init_vector_1 (stmt, init_stmt, gsi);