Add missing conversion in vect_create_epilog_for_reduction
diff mbox series

Message ID mpt1rtc5rzq.fsf@arm.com
State New
Headers show
Series
  • Add missing conversion in vect_create_epilog_for_reduction
Related show

Commit Message

Richard Sandiford Dec. 10, 2019, 11:39 a.m. UTC
The direct_slp_reduc code in vect_create_epilog_for_reduction was
still assuming that all types involved in a reduction are the same
(up to types_compatible_p), whereas we now support differences in
sign.  This was causing an ICE in gcc.dg/vect/pr92324-4.c for SVE.

Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?

Richard


2019-12-10  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vect-loop.c (vect_create_epilog_for_reduction): When
	handling direct_slp_reduc, allow the PHI arguments to have
	a different type from the vector elements.

Comments

Richard Biener Dec. 10, 2019, 12:13 p.m. UTC | #1
On December 10, 2019 12:39:53 PM GMT+01:00, Richard Sandiford <richard.sandiford@arm.com> wrote:
>The direct_slp_reduc code in vect_create_epilog_for_reduction was
>still assuming that all types involved in a reduction are the same
>(up to types_compatible_p), whereas we now support differences in
>sign.  This was causing an ICE in gcc.dg/vect/pr92324-4.c for SVE.
>
>Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?

Ok. 

Richard. 

>Richard
>
>
>2019-12-10  Richard Sandiford  <richard.sandiford@arm.com>
>
>gcc/
>	* tree-vect-loop.c (vect_create_epilog_for_reduction): When
>	handling direct_slp_reduc, allow the PHI arguments to have
>	a different type from the vector elements.
>
>Index: gcc/tree-vect-loop.c
>===================================================================
>--- gcc/tree-vect-loop.c	2019-12-10 11:30:23.506138368 +0000
>+++ gcc/tree-vect-loop.c	2019-12-10 11:38:37.322774821 +0000
>@@ -5054,6 +5054,8 @@ vect_create_epilog_for_reduction (stmt_v
> 	      tree scalar_value
> 		= PHI_ARG_DEF_FROM_EDGE (orig_phis[i]->stmt,
> 					 loop_preheader_edge (loop));
>+	      scalar_value = gimple_convert (&seq, TREE_TYPE (vectype),
>+					     scalar_value);
> 	      vector_identity = gimple_build_vector_from_val (&seq, vectype,
> 							      scalar_value);
> 	    }

Patch
diff mbox series

Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c	2019-12-10 11:30:23.506138368 +0000
+++ gcc/tree-vect-loop.c	2019-12-10 11:38:37.322774821 +0000
@@ -5054,6 +5054,8 @@  vect_create_epilog_for_reduction (stmt_v
 	      tree scalar_value
 		= PHI_ARG_DEF_FROM_EDGE (orig_phis[i]->stmt,
 					 loop_preheader_edge (loop));
+	      scalar_value = gimple_convert (&seq, TREE_TYPE (vectype),
+					     scalar_value);
 	      vector_identity = gimple_build_vector_from_val (&seq, vectype,
 							      scalar_value);
 	    }