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

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 4 05:10:43 PST 2025


================
@@ -4425,11 +4432,25 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
 
     // If NextVF is greater than the number of remaining iterations, the
     // epilogue loop would be dead. Skip such factors.
-    if (RemainingIterations && !NextVF.Width.isScalable()) {
-      if (SE.isKnownPredicate(
-              CmpInst::ICMP_UGT,
-              SE.getConstant(TCType, NextVF.Width.getFixedValue()),
-              RemainingIterations))
+    if (ScalableRemIter == NextVF.Width.isScalable()) {
+      if (SE.isKnownPredicate(CmpInst::ICMP_UGT,
----------------
david-arm wrote:

Given that you're asking the same thing each time, is it worth creating a small lambda function to do the work? For example,

```
  auto skipNextVF = [&] (ElementCount VF) -> bool {
    return SE.isKnownPredicate(...);
  };
```

and then calling this lambda function each time?

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


More information about the llvm-commits mailing list