]> git.ipfire.org Git - thirdparty/gcc.git/commit
vect: Don't vectorize a single scalar iteration loop [PR110740]
authorKewen Lin <linkw@linux.ibm.com>
Mon, 24 Jul 2023 06:20:30 +0000 (01:20 -0500)
committerKewen Lin <linkw@linux.ibm.com>
Mon, 24 Jul 2023 06:20:30 +0000 (01:20 -0500)
commitd07504725973ccdec78929a09dc13e5ebd9472f6
treeeea5e0232b3e05ebb8c7d5cf0af11160e3d52397
parent73ff915a169bf3f4b15c75fa3b6e658f7fe86b46
vect: Don't vectorize a single scalar iteration loop [PR110740]

The function vect_update_epilogue_niters which has been
removed by r14-2281 has some code taking care of that if
there is only one scalar iteration left for epilogue then
we won't try to vectorize it any more.

Although costing should be able to care about it eventually,
I think we still want this special casing without costing
enabled, so this patch is to add it back in function
vect_analyze_loop_costing, and make it more general for
both main and epilogue loops as Richi suggested, it can fix
some exposed failures on Power10:

 - gcc.target/powerpc/p9-vec-length-epil-{1,8}.c
 - gcc.dg/vect/slp-perm-{1,5,6,7}.c

PR tree-optimization/110740

gcc/ChangeLog:

* tree-vect-loop.cc (vect_analyze_loop_costing): Do not vectorize a
loop with a single scalar iteration.
gcc/tree-vect-loop.cc