[llvm] LV]: consider scalable VF during deciding dead epilogue. (PR #156724)

Hassnaa Hamdi via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 4 07:35:53 PST 2025


================
@@ -4407,6 +4407,13 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
     LLVM_DEBUG(dbgs() << "LEV: Maximum Trip Count for Epilogue: "
                       << MaxTripCount << "\n");
   }
+  // Check if the RemainingIterations is scalable.
----------------
hassnaaHamdi wrote:

Yes, it's just vscale, it could be handled by doing this:
```
const SCEV *KnownMinRemIter = SE->getOne(TCType), *EstimatedRemIter = nullptr;
  bool ScalableRemIter = 
match(RemainingIterations, m_scev_c_Mul(m_SCEV(KnownMinRemIter), m_SCEVVScale())) || match(RemainingIterations, m_SCEVVScale());
```
But I chose not to do that because that is handling for a single case that SCEV can't handle, not generic handling for scale-based complex forms that SCEV can't handle.
But also I don't have strong opinion, what do you think ?

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


More information about the llvm-commits mailing list