* [PATCH] Fix PR92473
@ 2019-11-13 8:05 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2019-11-13 8:05 UTC (permalink / raw)
To: gcc-patches
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
2019-11-13 Richard Biener <rguenther@suse.de>
PR tree-optimization/92473
* tree-vect-loop.c (vect_create_epilog_for_reduction): Perform
direct optab reduction in the correct type.
Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c (revision 278094)
+++ gcc/tree-vect-loop.c (working copy)
@@ -4739,31 +4739,13 @@ vect_create_epilog_for_reduction (stmt_v
dump_printf_loc (MSG_NOTE, vect_location,
"Reduce using direct vector reduction.\n");
+ gimple_seq stmts = NULL;
+ new_phi_result = gimple_convert (&stmts, vectype, new_phi_result);
vec_elem_type = TREE_TYPE (TREE_TYPE (new_phi_result));
- if (!useless_type_conversion_p (scalar_type, vec_elem_type))
- {
- tree tmp_dest
- = vect_create_destination_var (scalar_dest, vec_elem_type);
- epilog_stmt = gimple_build_call_internal (reduc_fn, 1,
- new_phi_result);
- gimple_set_lhs (epilog_stmt, tmp_dest);
- new_temp = make_ssa_name (tmp_dest, epilog_stmt);
- gimple_set_lhs (epilog_stmt, new_temp);
- gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT);
-
- epilog_stmt = gimple_build_assign (new_scalar_dest, NOP_EXPR,
- new_temp);
- }
- else
- {
- epilog_stmt = gimple_build_call_internal (reduc_fn, 1,
- new_phi_result);
- gimple_set_lhs (epilog_stmt, new_scalar_dest);
- }
-
- new_temp = make_ssa_name (new_scalar_dest, epilog_stmt);
- gimple_set_lhs (epilog_stmt, new_temp);
- gsi_insert_before (&exit_gsi, epilog_stmt, GSI_SAME_STMT);
+ new_temp = gimple_build (&stmts, as_combined_fn (reduc_fn),
+ vec_elem_type, new_phi_result);
+ new_temp = gimple_convert (&stmts, scalar_type, new_temp);
+ gsi_insert_seq_before (&exit_gsi, stmts, GSI_SAME_STMT);
if ((STMT_VINFO_REDUC_TYPE (reduc_info) == INTEGER_INDUC_COND_REDUCTION)
&& induc_val)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-11-13 8:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-13 8:05 [PATCH] Fix PR92473 Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).