[llvm] [LV] Use SCEV::getElementCount in selectEpilogueVectorizationFactor. (PR #150018)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 22 06:38:11 PDT 2025


================
@@ -152,6 +152,107 @@ exit:
   ret void
 }
 
+define void @main_vf_vscale_x_2_no_epi_iteration(ptr %A) #0 vscale_range(8, 8) {
----------------
david-arm wrote:

Could you also add a patch for loops that have a trip count that's a multiple of vscale where vscale_range = (1,16)? You can use Transforms/LoopVectorize/AArch64/sve-vscale-based-trip-counts.ll for inspiration:

```
entry:
  %0 = tail call i64 @llvm.vscale.i64()
  %1 = shl nuw nsw i64 %0, 2
  br label %for.body
for.body:
...
  %exitcond.not = icmp eq i64 %indvars.iv.next, %1
  br i1 %exitcond.not, label %for.cond.cleanup, label %for.body
```

I think in such cases we can also prove that are zero remaining iterations when choosing VF=vscale x 4.

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


More information about the llvm-commits mailing list