Skip to content

Commit 5e6ba18

Browse files
committed
[LV] Add test for const-folder crash
1 parent 96a957f commit 5e6ba18

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
; REQUIRES: asserts
2+
; RUN: not --crash opt -passes=loop-vectorize -force-vector-width=8 -disable-output %s
3+
4+
@postscale = external constant [64 x float]
5+
6+
define void @test(ptr %data) {
7+
entry:
8+
br label %loop
9+
10+
loop: ; preds = %loop, %entry
11+
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
12+
%or.iv.1 = or disjoint i64 %iv, 1
13+
%gep.postscale = getelementptr [64 x float], ptr @postscale, i64 0, i64 %or.iv.1
14+
%load.postscale = load float, ptr %gep.postscale, align 4, !tbaa !0
15+
%lrint = tail call i64 @llvm.lrint.i64.f32(float %load.postscale)
16+
%lrint.trunc = trunc i64 %lrint to i16
17+
store i16 %lrint.trunc, ptr %data, align 2, !tbaa !4
18+
%iv.next = add i64 %iv, 1
19+
%exit.cond = icmp eq i64 %iv.next, 8
20+
br i1 %exit.cond, label %end, label %loop
21+
22+
end: ; preds = %loop
23+
ret void
24+
}
25+
26+
!0 = !{!1, !1, i64 0}
27+
!1 = !{!"float", !2, i64 0}
28+
!2 = !{!"omnipotent char", !3, i64 0}
29+
!3 = !{!"Simple C/C++ TBAA"}
30+
!4 = !{!5, !5, i64 0}
31+
!5 = !{!"short", !2, i64 0}

0 commit comments

Comments
 (0)