Skip to content

Commit a1c3462

Browse files
committed
[LV] Add test for #87407
This bug is especially difficult to fix, since simplifyRecipes() simplifies the zext of 0 into the constant 0, removing an instruction and leaving a stale entry in the MinBWs map: a crash is subsequently observed in VPlanTransforms::truncateToMinimalBitwidths() due to a mismatch between the number of recipes processed and the number of entries in MinBWs. One possible way forward is to get simplifyRecipes() to erase entries from MinBWs when replacing Instructions with Constants. Check in the test to ease investigation, while we plan a way to fix the bug.
1 parent 8639b36 commit a1c3462

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
; REQUIRES: asserts
2+
; RUN: not --crash opt -passes=loop-vectorize -disable-output %s
3+
4+
define void @pr87407(ptr %dst, i64 %n) {
5+
entry:
6+
%zext.0 = zext i8 0 to i64
7+
br label %loop
8+
9+
loop:
10+
%iv = phi i64 [ %iv.next, %loop ], [ 0, %entry ]
11+
%max = tail call i64 @llvm.umax.i64(i64 %zext.0, i64 0)
12+
%cmp.max.0 = icmp ne i64 %max, 0
13+
%zext.cmp = zext i1 %cmp.max.0 to i64
14+
%trunc = trunc i64 %zext.cmp to i32
15+
%shl = shl i32 %trunc, 8
16+
%res = trunc i32 %shl to i8
17+
%iv.next = add i64 %iv, 1
18+
%exit.cond = icmp ne i64 %iv.next, %n
19+
br i1 %exit.cond, label %loop, label %exit
20+
21+
exit:
22+
store i8 %res, ptr %dst, align 1
23+
ret void
24+
}

0 commit comments

Comments
 (0)