vect: Add a vect_phi_initial_value helper function
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 13 Jul 2021 09:17:39 +0000 (10:17 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Tue, 13 Jul 2021 09:17:39 +0000 (10:17 +0100)
commitd592920c89973acd8d9f5b1f6b0526036ce63ccb
tree992d08b8f6db47ceaf02944b80b06748081898a4
parent32b8edd5297c9193b81122fdd55316fcbf0959dc
vect: Add a vect_phi_initial_value helper function

This patch adds a helper function called vect_phi_initial_value
for returning the incoming value of a given loop phi.  The main
reason for adding it is to ensure that the right preheader edge
is used when vectorising nested loops.  (PHI_ARG_DEF_FROM_EDGE
itself doesn't assert that the given edge is for the right block,
although I guess that would be good to add separately.)

gcc/
* tree-vectorizer.h: Include tree-ssa-operands.h.
(vect_phi_initial_value): New function.
* tree-vect-loop.c (neutral_op_for_slp_reduction): Use it.
(get_initial_defs_for_reduction, info_for_reduction): Likewise.
(vect_create_epilog_for_reduction, vectorizable_reduction): Likewise.
(vect_transform_cycle_phi, vectorizable_induction): Likewise.
gcc/tree-vect-loop.c
gcc/tree-vectorizer.h