[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:34:41 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:

> When RemainingIterations isn't in the form var x vscale what does the expression look like? If it's just RemainingIterations=vscale then presumably we can support that fairly easily here too?
In the current cases, it's just `RemainingIterations=vscale`, that could be supported by checking:
```
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