Skip to content

Commit 221e511

Browse files
committed
[LV] Add test for crash
1 parent dafa614 commit 221e511

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

llvm/test/Transforms/LoopVectorize/AArch64/sve2-histcnt.ll

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,29 @@ for.exit:
753753
ret void
754754
}
755755

756+
; The histogram operation generates vectors. This example used to crash
757+
; due to a missing entry in a switch statement.
758+
define void @histogram_generates_vectors_crash(ptr %data_array) {
759+
entry:
760+
br label %for.body
761+
762+
for.body:
763+
%iv = phi i64 [ 0, %entry ], [ %iv.next, %for.body ]
764+
%gep.indices = getelementptr [1048576 x i32], ptr null, i64 %iv
765+
%l.idx = load i32, ptr %gep.indices, align 4
766+
%idxprom5 = sext i32 %l.idx to i64
767+
%gep.bucket = getelementptr [1048576 x i32], ptr %data_array, i64 %idxprom5
768+
%l.bucket = load i32, ptr %gep.bucket, align 4
769+
%inc = add i32 %l.bucket, 0
770+
store i32 %inc, ptr %gep.bucket, align 4
771+
%iv.next = add i64 %iv, 1
772+
%exitcond = icmp eq i64 %iv, 1
773+
br i1 %exitcond, label %for.exit, label %for.body
774+
775+
for.exit:
776+
ret void
777+
}
778+
756779
attributes #0 = { "target-features"="+sve2" vscale_range(1,16) }
757780

758781
!0 = distinct !{!0, !1}

0 commit comments

Comments
 (0)