aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-11-14 09:19:28 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-11-14 09:19:28 +0000
commitf711908bf61e39432965db84ed12424cc6f251e1 (patch)
tree7e348a03b38fec7de949eb377b67eee3e0502318 /gcc/tree-vect-loop.c
parentc4071191f4d20d25389181b90c0a24f254a47b87 (diff)
downloadgcc-f711908bf61e39432965db84ed12424cc6f251e1.zip
gcc-f711908bf61e39432965db84ed12424cc6f251e1.tar.gz
gcc-f711908bf61e39432965db84ed12424cc6f251e1.tar.bz2
re PR tree-optimization/87974 (ICE in vect_get_vec_def_for_stmt_copy)
2018-11-14 Richard Biener <rguenther@suse.de> PR tree-optimization/87974 * tree-vect-loop.c (vectorizable_reduction): When computing the vectorized reduction PHI vector type ignore constant and external defs. * g++.dg/opt/pr87974.C: New testcase. From-SVN: r266099
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r--gcc/tree-vect-loop.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index dccddee..dac6bb8 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -6066,13 +6066,17 @@ vectorizable_reduction (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
return true;
gassign *reduc_stmt = as_a <gassign *> (reduc_stmt_info->stmt);
+ code = gimple_assign_rhs_code (reduc_stmt);
for (unsigned k = 1; k < gimple_num_ops (reduc_stmt); ++k)
{
tree op = gimple_op (reduc_stmt, k);
if (op == phi_result)
continue;
- if (k == 1
- && gimple_assign_rhs_code (reduc_stmt) == COND_EXPR)
+ if (k == 1 && code == COND_EXPR)
+ continue;
+ bool is_simple_use = vect_is_simple_use (op, loop_vinfo, &dt);
+ gcc_assert (is_simple_use);
+ if (dt == vect_constant_def || dt == vect_external_def)
continue;
if (!vectype_in
|| (GET_MODE_SIZE (SCALAR_TYPE_MODE (TREE_TYPE (vectype_in)))