aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-11-18 10:32:29 +0100
committerRichard Biener <rguenther@suse.de>2020-11-18 11:25:00 +0100
commit30270bf042049bf6aee6184e0b7688d9ca7b479d (patch)
tree7c00ade8899e6669645ecb9b81494a4d9e9183a7 /gcc/tree-vect-loop.c
parent798bdfa0ebcf2bd012ffce75a594f783a8cb2dd0 (diff)
downloadgcc-30270bf042049bf6aee6184e0b7688d9ca7b479d.zip
gcc-30270bf042049bf6aee6184e0b7688d9ca7b479d.tar.gz
gcc-30270bf042049bf6aee6184e0b7688d9ca7b479d.tar.bz2
tree-optimization/97886 - deal with strange LC PHI nodes
This makes vectorization properly assign vector types to PHI nodes that copy from externals on loop exit edges. 2020-11-18 Richard Biener <rguenther@suse.de> PR tree-optimization/97886 * tree-vect-loop.c (vectorizable_lc_phi): Properly assign vector types to invariants for SLP.
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r--gcc/tree-vect-loop.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index ecaaf01..856bbfe 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -7593,6 +7593,17 @@ vectorizable_lc_phi (loop_vec_info loop_vinfo,
if (!vec_stmt) /* transformation not required. */
{
+ /* Deal with copies from externs or constants that disguise as
+ loop-closed PHI nodes (PR97886). */
+ if (slp_node
+ && !vect_maybe_update_slp_op_vectype (SLP_TREE_CHILDREN (slp_node)[0],
+ SLP_TREE_VECTYPE (slp_node)))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "incompatible vector types for invariants\n");
+ return false;
+ }
STMT_VINFO_TYPE (stmt_info) = lc_phi_info_type;
return true;
}