[WinEH] Update LCSSA to handle catchswitch with handlers inside and outside a loop
[oota-llvm.git] / test / Transforms / LoopUnswitch / crash.ll
1 ; RUN: opt < %s -loop-unswitch -disable-output
2
3 define void @test1(i32* %S2) {
4 entry:
5         br i1 false, label %list_Length.exit, label %cond_true.i
6 cond_true.i:            ; preds = %entry
7         ret void
8 list_Length.exit:               ; preds = %entry
9         br i1 false, label %list_Length.exit9, label %cond_true.i5
10 cond_true.i5:           ; preds = %list_Length.exit
11         ret void
12 list_Length.exit9:              ; preds = %list_Length.exit
13         br i1 false, label %bb78, label %return
14 bb44:           ; preds = %bb78, %cond_next68
15         br i1 %tmp49.not, label %bb62, label %bb62.loopexit
16 bb62.loopexit:          ; preds = %bb44
17         br label %bb62
18 bb62:           ; preds = %bb62.loopexit, %bb44
19         br i1 false, label %return.loopexit, label %cond_next68
20 cond_next68:            ; preds = %bb62
21         br i1 false, label %return.loopexit, label %bb44
22 bb78:           ; preds = %list_Length.exit9
23         %tmp49.not = icmp eq i32* %S2, null             ; <i1> [#uses=1]
24         br label %bb44
25 return.loopexit:                ; preds = %cond_next68, %bb62
26         %retval.0.ph = phi i32 [ 1, %cond_next68 ], [ 0, %bb62 ]                ; <i32> [#uses=1]
27         br label %return
28 return:         ; preds = %return.loopexit, %list_Length.exit9
29         %retval.0 = phi i32 [ 0, %list_Length.exit9 ], [ %retval.0.ph, %return.loopexit ]               ; <i32> [#uses=0]
30         ret void
31 }
32
33 define void @test2(i32 %x1, i32 %y1, i32 %z1, i32 %r1) nounwind {
34 entry:
35   br label %bb.nph
36
37 bb.nph:                                           ; preds = %entry
38   %and.i13521 = and <4 x i1> undef, undef         ; <<4 x i1>> [#uses=1]
39   br label %for.body
40
41 for.body:                                         ; preds = %for.body, %bb.nph
42   %or.i = select <4 x i1> %and.i13521, <4 x i32> undef, <4 x i32> undef ; <<4 x i32>> [#uses=0]
43   br i1 false, label %for.body, label %for.end
44
45 for.end:                                          ; preds = %for.body, %entry
46   ret void
47 }
48
49 ; PR6879
50 define i32* @test3(i32** %p_45, i16 zeroext %p_46, i64 %p_47, i64 %p_48, i16 signext %p_49) nounwind {
51 entry:
52   br label %for.cond
53
54 for.cond:                                         ; preds = %for.cond4, %entry
55   br i1 false, label %for.cond4, label %for.end88
56
57 for.cond4:                                        ; preds = %for.cond
58   %conv46 = trunc i32 0 to i8                     ; <i8> [#uses=2]
59   %cmp60 = icmp sgt i8 %conv46, 124               ; <i1> [#uses=1]
60   %or.cond = and i1 undef, %cmp60                 ; <i1> [#uses=1]
61   %cond = select i1 %or.cond, i8 %conv46, i8 undef ; <i8> [#uses=0]
62   br label %for.cond
63
64 for.end88:                                        ; preds = %for.cond
65   ret i32* undef
66 }