On 19/01/2022 11:04, Richard Biener wrote: > On Tue, 18 Jan 2022, Andre Vieira (lists) wrote: > >> On 14/01/2022 09:57, Richard Biener wrote: >>> The 'used_vector_modes' is also a heuristic by itself since it registers >>> every vector type we query, not only those that are used in the end ... >>> >>> So it's really all heuristics that can eventually go bad. >>> >>> IMHO remembering the VF that we ended up with (maybe w/o unrolling) >>> for each analyzed vector_mode[] might be really the easiest thing to do, >>> that should make it easy to skip those modes where the VF is larger >>> or equal as the VF of the main loop for the purpose of epilogue >>> vectorization. Likewise those vector_mode[] that failed analysis can >>> be remembered (with -1U VF for example). >>> >>> Richard. >> I liked the caching suggestion, so here it is. Sorry for the delay, wanted to >> post this after pushing the vect unroll which was waiting on some retesting >> for the rebase. > LGTM. > > Thanks, > Richard. > >> gcc/ChangeLog: >> >>         PR 103997 >>         * tree-vect-loop.c (vect_analyze_loop): Fix mode skipping for >> epilogue >>         vectorization. Thanks! Committed the following patch. I updated the comment above the last change as I realized it still described the old behaviour.