[llvm] [LV] Consider whether vscale is a known power of two for iteration check (PR #144963)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 20 08:50:48 PDT 2025
david-arm wrote:
If the load is guaranteed to be dereferenceable it will be treated as a normal load, so this also should work:
```
define void @foo(i32 %val, ptr dereferenceable(1024) %ptr) {
entry:
br label %while.body
while.body: ; preds = %while.body, %entry
%index = phi i64 [ %index.next, %while.body ], [ 0, %entry ]
%gep = getelementptr i32, ptr %ptr, i64 %index
%ld1 = load i32, ptr %gep, align 4
%index.next = add nsw i64 %index, 1
%cmp10 = icmp ult i64 %index.next, 256
br i1 %cmp10, label %while.body, label %while.end.loopexit, !llvm.loop !0
while.end.loopexit: ; preds = %while.body
ret void
}
!0 = distinct !{!0, !1, !2, !3, !4}
!1 = !{!"llvm.loop.vectorize.predicate.enable", i1 true}
!2 = !{!"llvm.loop.vectorize.scalable.enable", i1 true}
!3 = !{!"llvm.loop.interleave.count", i32 1}
!4 = !{!"llvm.loop.vectorize.width", i32 4}
```
https://github.com/llvm/llvm-project/pull/144963
More information about the llvm-commits
mailing list