Skip to content

Commit 5ad8fb2

Browse files
- Add an assert for !isSafeForAnyVectorWidth()
- Cleanup test
1 parent 444e58c commit 5ad8fb2

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9910,6 +9910,8 @@ bool LoopVectorizePass::processLoop(Loop *L) {
99109910
}
99119911

99129912
if (UserIC == 1 && Hints.getInterleave() > 1) {
9913+
assert(!LVL.isSafeForAnyVectorWidth() &&
9914+
"UserIC should only be ignored due to unsafe dependencies");
99139915
LLVM_DEBUG(dbgs() << "LV: Ignoring user-specified interleave count.\n");
99149916
IntDiagMsg = {"InterleavingUnsafe",
99159917
"Ignoring user-specified interleave count due to possibly "

llvm/test/Transforms/LoopVectorize/unsafe-ic-hint-remark.ll

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,22 @@
44

55
; CHECK: remark: <unknown>:0:0: Ignoring user-specified interleave count due to possibly unsafe dependencies in the loop.
66
; CHECK-LABEL: @loop_distance_4
7-
define void @loop_distance_4(i64 %N, ptr %a, ptr %b) {
7+
define void @loop_distance_4(ptr %a, ptr %b) {
88
entry:
9-
%cmp10 = icmp sgt i64 %N, 4
10-
br i1 %cmp10, label %for.body, label %for.end
9+
br label %loop
1110

12-
for.body:
13-
%indvars.iv = phi i64 [ 4, %entry ], [ %indvars.iv.next, %for.body ]
14-
%0 = getelementptr i32, ptr %b, i64 %indvars.iv
11+
loop:
12+
%iv = phi i64 [ 4, %entry ], [ %iv.next, %loop ]
13+
%0 = getelementptr i32, ptr %b, i64 %iv
1514
%arrayidx = getelementptr i8, ptr %0, i64 -16
1615
%1 = load i32, ptr %arrayidx, align 4
17-
%arrayidx2 = getelementptr inbounds nuw i32, ptr %a, i64 %indvars.iv
16+
%arrayidx2 = getelementptr inbounds nuw i32, ptr %a, i64 %iv
1817
%2 = load i32, ptr %arrayidx2, align 4
1918
%add = add nsw i32 %2, %1
2019
store i32 %add, ptr %0, align 4
21-
%indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
22-
%exitcond.not = icmp eq i64 %indvars.iv.next, %N
23-
br i1 %exitcond.not, label %for.end, label %for.body, !llvm.loop !1
20+
%iv.next = add nuw nsw i64 %iv, 1
21+
%exitcond.not = icmp eq i64 %iv.next, 64
22+
br i1 %exitcond.not, label %for.end, label %loop, !llvm.loop !1
2423

2524
for.end:
2625
ret void

0 commit comments

Comments
 (0)