[llvm] [LV] Don't vectorize epilogue with scalable VF if no iterations remain. (PR #149789)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 22 01:00:56 PDT 2025


================
@@ -4479,6 +4479,27 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
   Type *TCType = Legal->getWidestInductionType();
   const SCEV *RemainingIterations = nullptr;
   unsigned MaxTripCount = 0;
+  if (MainLoopVF.isFixed()) {
----------------
david-arm wrote:

Hmm, I tried https://github.com/llvm/llvm-project/pull/146102 in combination with this PR and ran `opt -p loop-vectorize -force-vector-interleave=1 -epilogue-vectorization-minimum-VF=2 -S < ../llvm/test/Transforms/LoopVectorize/AArch64/sve-vscale-based-trip-counts.ll` and I didn't hit any errors even though there are no remaining iterations in test `vscale_mul_4`. Perhaps the vscale multiplier still gets in the way somewhere.

https://github.com/llvm/llvm-project/pull/149789


More information about the llvm-commits mailing list