Skip to content

Commit

Permalink
[LV] add test for #47665, #88802 (#91135)
Browse files Browse the repository at this point in the history
  • Loading branch information
artagnon authored May 24, 2024
1 parent b2f65e8 commit dc148c9
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
31 changes: 31 additions & 0 deletions llvm/test/Transforms/LoopVectorize/RISCV/pr88802.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
; REQUIRES: asserts
; RUN: not --crash opt -passes=loop-vectorize -mtriple=riscv64 -mattr=+v -disable-output %s

define void @test(ptr %p, i64 %a, i8 %b) {
entry:
br label %for.cond

for.cond: ; preds = %for.body, %entry
%iv = phi i32 [ 0, %entry ], [ %add, %for.body ]
%add = add i32 %iv, 1
%cmp.slt = icmp slt i32 %iv, 2
%shl = shl i64 %a, 48
%ashr = ashr i64 %shl, 52
%trunc.i32 = trunc i64 %ashr to i32
br i1 %cmp.slt, label %cond.false, label %for.body

cond.false: ; preds = %for.cond
%zext = zext i8 %b to i32
br label %for.body

for.body: ; preds = %cond.false, %for.cond
%cond = phi i32 [ %trunc.i32, %for.cond ], [ %zext, %cond.false ]
%shl.i32 = shl i32 %cond, 8
%trunc = trunc i32 %shl.i32 to i8
store i8 %trunc, ptr %p, align 1
%cmp = icmp slt i32 %iv, 2
br i1 %cmp, label %for.cond, label %exit

exit: ; preds = %for.body
ret void
}
25 changes: 25 additions & 0 deletions llvm/test/Transforms/LoopVectorize/SystemZ/pr47665.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
; REQUIRES: asserts
; RUN: not --crash opt -passes=loop-vectorize -mtriple=s390x -mcpu=z14 -disable-output %s

define void @test(ptr %p, i40 %a) {
entry:
br label %for.body

for.body: ; preds = %for.body, %entry
%iv = phi i32 [ 0, %entry ], [ %iv.next, %for.body ]
%shl = shl i40 %a, 24
%ashr = ashr i40 %shl, 28
%trunc = trunc i40 %ashr to i32
%icmp.eq = icmp eq i32 %trunc, 0
%zext = zext i1 %icmp.eq to i32
%icmp.ult = icmp ult i32 0, %zext
%or = or i1 %icmp.ult, true
%icmp.sgt = icmp sgt i1 %or, false
store i1 %icmp.sgt, ptr %p, align 1
%iv.next = add i32 %iv, 1
%cond = icmp ult i32 %iv.next, 10
br i1 %cond, label %for.body, label %exit

exit: ; preds = %for.body
ret void
}

0 comments on commit dc148c9

Please sign in to comment.