Skip to content

Commit dd927f4

Browse files
committed
[Test] Add test exposing crash in SimpleLoopUnswitch
The test crashes with an assert in unswitchNontrivialInvariants.
1 parent b24e2f6 commit dd927f4

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
; RUN: opt -passes='loop(simple-loop-unswitch<nontrivial>),verify<loops>' -S < %s | FileCheck %s
2+
; RUN: opt -passes='loop-mssa(simple-loop-unswitch<nontrivial>),verify<loops>' -S < %s | FileCheck %s
3+
; RUN: opt -simple-loop-unswitch -enable-nontrivial-unswitch -verify-memoryssa -S < %s | FileCheck %s
4+
5+
declare ptr @pluto()
6+
declare void @llvm.experimental.guard(i1, ...)
7+
declare void @widget()
8+
9+
; REQUIRES: asserts
10+
; XFAIL: *
11+
12+
define void @foo(ptr addrspace(1) %arg, i64 %arg1) personality ptr @pluto {
13+
bb:
14+
%tmp = icmp slt i32 poison, 570
15+
%tmp2 = select i1 %tmp, i1 true, i1 false
16+
br label %bb3
17+
18+
bb3: ; preds = %bb6, %bb
19+
call void (i1, ...) @llvm.experimental.guard(i1 %tmp2, i32 7) [ "deopt"() ]
20+
invoke void @widget()
21+
to label %bb4 unwind label %bb7
22+
23+
bb4: ; preds = %bb3
24+
invoke void @widget()
25+
to label %bb6 unwind label %bb7
26+
27+
bb6: ; preds = %bb4
28+
invoke void @widget()
29+
to label %bb3 unwind label %bb7
30+
31+
bb7: ; preds = %bb6, %bb4, %bb3
32+
%tmp8 = landingpad { ptr, i32 }
33+
cleanup
34+
ret void
35+
}
36+

0 commit comments

Comments
 (0)