Skip to content

Commit 17f98ba

Browse files
committed
[LV] Add test with users both demanding all lanes and first-lane-only.
Add a test case where scalar steps are used by both a VPReplicateRecipe (demands all scalar lanes) and a VPInstruction that only demands the first lane. Test case for #88849.
1 parent b7b0071 commit 17f98ba

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
; REQUIRES: asserts
2+
; RUN: not --crash opt -p loop-vectorize -mtriple=s390x-unknown-linux -mcpu=z16 %s
3+
4+
target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-v128:64-a:8:16-n32:64"
5+
6+
@src = external global [8 x i32], align 4
7+
8+
; Test case where scalar steps are used by both a VPReplicateRecipe (demands
9+
; all scalar lanes) and a VPInstruction that only demands the first lane.
10+
; Test case for https://github.com/llvm/llvm-project/issues/88849.
11+
define void @test_scalar_iv_steps_used_by_replicate_and_first_lane_only_vpinst(ptr noalias %dst, ptr noalias %src.1) {
12+
entry:
13+
br label %loop.header
14+
15+
loop.header:
16+
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop.latch ]
17+
%mul.iv = mul nsw i64 %iv, 4
18+
%gep.src.1 = getelementptr inbounds i8, ptr %src.1, i64 %mul.iv
19+
%l.1 = load i8, ptr %gep.src.1, align 1
20+
%c = icmp eq i8 %l.1, 0
21+
br i1 %c, label %then, label %loop.latch
22+
23+
then:
24+
%iv.or = or disjoint i64 %iv, 4
25+
%gep.src = getelementptr inbounds [8 x i32], ptr @src, i64 0, i64 %iv.or
26+
%l.2 = load i32, ptr %gep.src, align 4
27+
store i32 %l.2, ptr %dst, align 4
28+
br label %loop.latch
29+
30+
loop.latch:
31+
%iv.next = add nuw nsw i64 %iv, 1
32+
%ec = icmp eq i64 %iv.next, 4
33+
br i1 %ec, label %exit, label %loop.header
34+
35+
exit:
36+
ret void
37+
}

0 commit comments

Comments
 (0)