aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-06-30 08:08:33 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-06-30 08:08:33 +0000
commit4812f0b73c076ead7371785770a1736cf4ed1f49 (patch)
treed9d3ce92557a66fe1c5d1bfe7920384473f8ed14 /gcc/tree-vect-loop.c
parent5ef4d61d2b24760fe5f7dad84f8201e094bacad9 (diff)
downloadgcc-4812f0b73c076ead7371785770a1736cf4ed1f49.zip
gcc-4812f0b73c076ead7371785770a1736cf4ed1f49.tar.gz
gcc-4812f0b73c076ead7371785770a1736cf4ed1f49.tar.bz2
re PR tree-optimization/81249 (ICE: error: incompatible types in PHI argument 0)
2017-06-30 Richard Biener <rguenther@suse.de> PR tree-optimization/81249 * tree-vect-loop.c (vect_create_epilog_for_reduction): Convert condition reduction result to original scalar type. * g++.dg/torture/pr81249.C: New testcase. From-SVN: r249831
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r--gcc/tree-vect-loop.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 576a42f..bab0cdd 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -4835,12 +4835,9 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt,
/* Convert the reduced value back to the result type and set as the
result. */
- tree data_reduc_cast = build1 (VIEW_CONVERT_EXPR, scalar_type,
- data_reduc);
- epilog_stmt = gimple_build_assign (new_scalar_dest, data_reduc_cast);
- new_temp = make_ssa_name (new_scalar_dest, epilog_stmt);
- gimple_assign_set_lhs (epilog_stmt, new_temp);
- gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT);
+ gimple_seq stmts = NULL;
+ new_temp = gimple_convert (&stmts, scalar_type, data_reduc);
+ gsi_insert_seq_before (&exit_gsi, stmts, GSI_SAME_STMT);
scalar_results.safe_push (new_temp);
}
else if (STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info) == COND_REDUCTION
@@ -4905,6 +4902,11 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt,
val = new_val;
}
}
+ /* Convert the reduced value back to the result type and set as the
+ result. */
+ gimple_seq stmts = NULL;
+ val = gimple_convert (&stmts, scalar_type, val);
+ gsi_insert_seq_before (&exit_gsi, stmts, GSI_SAME_STMT);
scalar_results.safe_push (val);
}