diff options
author | Richard Biener <rguenther@suse.de> | 2021-09-07 11:46:00 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2021-09-07 13:10:37 +0200 |
commit | 843068149ec8fcaaaec12751f5b70221a1153857 (patch) | |
tree | 2da52fef02eac80cbd874dfcb58d9d4fd7b2026c /gcc/tree-vect-loop.c | |
parent | ba1cc6956b956eb5b92c45af79a8b1fe426ec4d3 (diff) | |
download | gcc-843068149ec8fcaaaec12751f5b70221a1153857.zip gcc-843068149ec8fcaaaec12751f5b70221a1153857.tar.gz gcc-843068149ec8fcaaaec12751f5b70221a1153857.tar.bz2 |
tree-optimization/102226 - fix epilogue vector re-use
This fixes re-use of the reduction value in epilogue vectorization
when a conversion from/to variable lenght vectors is required.
2021-09-07 Richard Biener <rguenther@suse.de>
PR tree-optimization/102226
* tree-vect-loop.c (vect_transform_cycle_phi): Record
the converted value for the epilogue PHI use.
* g++.dg/vect/pr102226.cc: New testcase.
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r-- | gcc/tree-vect-loop.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 0c8d992..c9dcc64 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -7755,11 +7755,11 @@ vect_transform_cycle_phi (loop_vec_info loop_vinfo, (reduc_info), &stmts); } + if (!useless_type_conversion_p (vectype_out, TREE_TYPE (def))) + def = gimple_convert (&stmts, vectype_out, def); /* Adjust the input so we pick up the partially reduced value for the skip edge in vect_create_epilog_for_reduction. */ accumulator->reduc_input = def; - if (!useless_type_conversion_p (vectype_out, TREE_TYPE (def))) - def = gimple_convert (&stmts, vectype_out, def); if (loop_vinfo->main_loop_edge) { /* While we'd like to insert on the edge this will split |