[llvm] [LoopVectorize] Improve Vectorization of Low Trip Count Loops (PR #195823)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 26 05:01:45 PDT 2026


================
@@ -5871,6 +5894,18 @@ LoopVectorizationPlanner::computeBestVF() {
     if (ConsiderRegPressure)
       RUs = calculateRegisterUsageForPlan(*P, VFs, TTI);
 
+    // For loops where the Trip Count is below the Tail Folding Threshold, only
+    // consider the largest VF to ensure, where TC == VF * IC or TC - 1 == VF *
+    // IC, one vector iteration, and one scalar iteration if needed is
+    // generated.
----------------
sdesmalen-arm wrote:

```suggestion
    // consider only the largest VF so to end up with at most one vector iteration
    // and at most one scalar iteration.
```

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


More information about the llvm-commits mailing list