aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-11-05 10:10:46 +0100
committerRichard Biener <rguenther@suse.de>2021-11-05 14:34:42 +0100
commitbcf4065c909bd1010208117633ca9ff84cd7b38e (patch)
tree5871261e2d1a8bffc0aca69062c111cd21b39259 /gcc/tree-vectorizer.c
parentea42c80585b831fc4f7a0b2576a3d8d3244d8d32 (diff)
downloadgcc-bcf4065c909bd1010208117633ca9ff84cd7b38e.zip
gcc-bcf4065c909bd1010208117633ca9ff84cd7b38e.tar.gz
gcc-bcf4065c909bd1010208117633ca9ff84cd7b38e.tar.bz2
Split vector loop analysis into main and epilogue analysis
As discussed this splits the analysis loop into two, first settling on a vector mode used for the main loop and only then analyzing the epilogue of that for possible vectorization. That makes it easier to put in support for unrolled main loops. On the way I've realized some cleanup opportunities, namely caching n_stmts in vec_info_shared (it's computed by dataref analysis) avoiding to pass that around and setting/clearing loop->aux during analysis - try_vectorize_loop_1 will ultimatively set it on those we vectorize. This also gets rid of the previously introduced callback in vect_analyze_loop_1 in favor of making that advance the mode iterator. I'm now pushing VOIDmode explicitely into the vector_modes array which makes the re-start on the epilogue side a bit more straight-forward. Note that will now use auto-detection of the vector mode in case the main loop used it and we want to try LOOP_VINFO_EPIL_USING_PARTIAL_VECTORS_P and the first mode from the target array if not. I've added a comment that says we may want to make sure we don't try vectorizing the epilogue with a bigger vector size than the main loop but the situation isn't very likely to appear in practice I guess (and it was also present before this change). In principle this change should not change vectorization decisions but the way we handled re-analyzing epilogues as main loops makes me only 99% sure that it does. 2021-11-05 Richard Biener <rguenther@suse.de> * tree-vectorizer.h (vec_info_shared::n_stmts): Add. (LOOP_VINFO_N_STMTS): Likewise. (vec_info_for_bb): Remove unused function. * tree-vectorizer.c (vec_info_shared::vec_info_shared): Initialize n_stmts member. * tree-vect-loop.c: Remove INCLUDE_FUNCTIONAL. (vect_create_loop_vinfo): Do not set loop->aux. (vect_analyze_loop_2): Do not get n_stmts as argument, instead use LOOP_VINFO_N_STMTS. Set LOOP_VINFO_VECTORIZABLE_P here. (vect_analyze_loop_1): Remove callback, get the mode iterator and autodetected_vector_mode as argument, advancing the iterator and initializing autodetected_vector_mode here. (vect_analyze_loop): Split analysis loop into two, first processing main loops only and then epilogues.
Diffstat (limited to 'gcc/tree-vectorizer.c')
-rw-r--r--gcc/tree-vectorizer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 4c9ab81..a2e13ac 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -475,7 +475,8 @@ vec_info::~vec_info ()
}
vec_info_shared::vec_info_shared ()
- : datarefs (vNULL),
+ : n_stmts (0),
+ datarefs (vNULL),
datarefs_copy (vNULL),
ddrs (vNULL)
{