Skip to content

Commit dc148c9

Browse files
authored
[LV] add test for #47665, #88802 (#91135)
1 parent b2f65e8 commit dc148c9

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-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 -mtriple=riscv64 -mattr=+v -disable-output %s
3+
4+
define void @test(ptr %p, i64 %a, i8 %b) {
5+
entry:
6+
br label %for.cond
7+
8+
for.cond: ; preds = %for.body, %entry
9+
%iv = phi i32 [ 0, %entry ], [ %add, %for.body ]
10+
%add = add i32 %iv, 1
11+
%cmp.slt = icmp slt i32 %iv, 2
12+
%shl = shl i64 %a, 48
13+
%ashr = ashr i64 %shl, 52
14+
%trunc.i32 = trunc i64 %ashr to i32
15+
br i1 %cmp.slt, label %cond.false, label %for.body
16+
17+
cond.false: ; preds = %for.cond
18+
%zext = zext i8 %b to i32
19+
br label %for.body
20+
21+
for.body: ; preds = %cond.false, %for.cond
22+
%cond = phi i32 [ %trunc.i32, %for.cond ], [ %zext, %cond.false ]
23+
%shl.i32 = shl i32 %cond, 8
24+
%trunc = trunc i32 %shl.i32 to i8
25+
store i8 %trunc, ptr %p, align 1
26+
%cmp = icmp slt i32 %iv, 2
27+
br i1 %cmp, label %for.cond, label %exit
28+
29+
exit: ; preds = %for.body
30+
ret void
31+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
; REQUIRES: asserts
2+
; RUN: not --crash opt -passes=loop-vectorize -mtriple=s390x -mcpu=z14 -disable-output %s
3+
4+
define void @test(ptr %p, i40 %a) {
5+
entry:
6+
br label %for.body
7+
8+
for.body: ; preds = %for.body, %entry
9+
%iv = phi i32 [ 0, %entry ], [ %iv.next, %for.body ]
10+
%shl = shl i40 %a, 24
11+
%ashr = ashr i40 %shl, 28
12+
%trunc = trunc i40 %ashr to i32
13+
%icmp.eq = icmp eq i32 %trunc, 0
14+
%zext = zext i1 %icmp.eq to i32
15+
%icmp.ult = icmp ult i32 0, %zext
16+
%or = or i1 %icmp.ult, true
17+
%icmp.sgt = icmp sgt i1 %or, false
18+
store i1 %icmp.sgt, ptr %p, align 1
19+
%iv.next = add i32 %iv, 1
20+
%cond = icmp ult i32 %iv.next, 10
21+
br i1 %cond, label %for.body, label %exit
22+
23+
exit: ; preds = %for.body
24+
ret void
25+
}

0 commit comments

Comments
 (0)