[LV] Consider if scalar epilogue is required in getMaximizedVFForTarget.
authorFlorian Hahn <flo@fhahn.com>
Thu, 6 Jul 2023 12:31:44 +0000 (13:31 +0100)
committerFlorian Hahn <flo@fhahn.com>
Thu, 6 Jul 2023 12:35:35 +0000 (13:35 +0100)
commita0fcf84a8c4d953730170f8f2da17a7556991607
tree452e45c246ad452eff9ba3b26b74541e29124a7b
parent7cea22c0be95834317c920c21839cdd4c80fbdd8
[LV] Consider if scalar epilogue is required in getMaximizedVFForTarget.

When a scalar epilogue is required, at least one iteration of the scalar loop
has to execute. Adjust ConstTripCount accordingly to avoid picking a max VF
that results in a dead vector loop.

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D154261
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/X86/limit-vf-by-tripcount.ll
llvm/test/Transforms/LoopVectorize/X86/pr56319-vector-exit-cond-optimization-epilogue-vectorization.ll