aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2016-01-12 11:41:16 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-01-12 11:41:16 +0000
commit8eac49b1b601fd9eba47c14f9ebea5779446be46 (patch)
treece7f132db431a5b8414735154118818516dc833e /gcc/tree-vect-loop.c
parent5b723b6806dc86853fff5a1b30b9c505f870e800 (diff)
downloadgcc-8eac49b1b601fd9eba47c14f9ebea5779446be46.zip
gcc-8eac49b1b601fd9eba47c14f9ebea5779446be46.tar.gz
gcc-8eac49b1b601fd9eba47c14f9ebea5779446be46.tar.bz2
re PR target/69053 (ICE in build_vector_from_val)
2016-01-12 Richard Biener <rguenther@suse.de> PR tree-optimization/69053 * tree-vect-loop.c (get_initial_def_for_reduction): Properly convert initial value for cond reductions. * g++.dg/torture/pr69053.C: New testcase. From-SVN: r232263
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r--gcc/tree-vect-loop.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 706a25d..0933e7e 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -4075,10 +4075,10 @@ get_initial_def_for_reduction (gimple *stmt, tree init_val,
tree *elts;
int i;
bool nested_in_vect_loop = false;
- tree init_value;
REAL_VALUE_TYPE real_init_val = dconst0;
int int_init_val = 0;
gimple *def_stmt = NULL;
+ gimple_seq stmts = NULL;
gcc_assert (vectype);
nunits = TYPE_VECTOR_SUBPARTS (vectype);
@@ -4107,16 +4107,6 @@ get_initial_def_for_reduction (gimple *stmt, tree init_val,
return vect_create_destination_var (init_val, vectype);
}
- if (TREE_CONSTANT (init_val))
- {
- if (SCALAR_FLOAT_TYPE_P (scalar_type))
- init_value = build_real (scalar_type, TREE_REAL_CST (init_val));
- else
- init_value = build_int_cst (scalar_type, TREE_INT_CST_LOW (init_val));
- }
- else
- init_value = init_val;
-
switch (code)
{
case WIDEN_SUM_EXPR:
@@ -4193,7 +4183,10 @@ get_initial_def_for_reduction (gimple *stmt, tree init_val,
break;
}
}
- init_def = build_vector_from_val (vectype, init_value);
+ init_val = gimple_convert (&stmts, TREE_TYPE (vectype), init_val);
+ if (! gimple_seq_empty_p (stmts))
+ gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
+ init_def = build_vector_from_val (vectype, init_val);
break;
default: