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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 21 07:37:11 PDT 2025


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

Oh I see. Once we support that, we need to update the code here.

The reason for the assert is that `simplifyBranchConditionForVFAndUF` can remove the vector loop branch, which in turn means we cannot recover the induction resume value for the epilogue loop, because none exits. I could also try to fix that, but it will quickly become dead code.



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


More information about the llvm-commits mailing list