1; RUN: opt -loop-unroll -S < %s | FileCheck %s
2target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
3target triple = "i686-pc-windows-msvc"
4
5declare void @fn1(i8*)
6
7declare i1 @fn2(i8*, i8*)
8
9define void @fn4() personality i32 (...)* @__CxxFrameHandler3 {
10entry:
11  br label %for.body
12
13for.body:                                         ; preds = %for.inc, %entry
14  %i.05 = phi i8 [ 0, %entry ], [ %inc, %for.inc ]
15  store i8 undef, i8* undef, align 4
16  invoke void @fn1(i8* undef)
17          to label %call.i.noexc unwind label %ehcleanup
18
19call.i.noexc:                                     ; preds = %for.body
20  %call1.i2 = invoke i1 @fn2(i8* undef, i8* undef)
21          to label %call1.i.noexc unwind label %ehcleanup
22
23call1.i.noexc:                                    ; preds = %call.i.noexc
24  br i1 undef, label %if.then.i, label %if.end4.i
25
26if.then.i:                                        ; preds = %call1.i.noexc
27  %tmp1 = load i8, i8* undef, align 4
28  %tobool.i = icmp eq i8 undef, undef
29  br i1 undef, label %if.end4.i, label %if.then2.i
30
31if.then2.i:                                       ; preds = %if.then.i
32  %call3.i3 = invoke i1 @fn2(i8* undef, i8* null)
33          to label %call3.i.noexc unwind label %ehcleanup
34
35call3.i.noexc:                                    ; preds = %if.then2.i
36  br label %if.end4.i
37
38if.end4.i:                                        ; preds = %call3.i.noexc, %if.then.i, %call1.i.noexc
39  %tmp2 = load i8, i8* undef, align 4
40  br label %if.then6.i
41
42if.then6.i:                                       ; preds = %if.end4.i
43  %call7.i4 = invoke i1 @fn2(i8* undef, i8* null)
44          to label %call7.i.noexc unwind label %ehcleanup
45
46call7.i.noexc:                                    ; preds = %if.then6.i
47  br label %fn3
48
49fn3:                                              ; preds = %call7.i.noexc
50  %tmp3 = load i8, i8* undef, align 4
51  %inc.i = add nsw i8 undef, undef
52  store i8 undef, i8* undef, align 4
53  br label %for.inc
54
55for.inc:                                          ; preds = %fn3
56  %inc = add nsw i8 %i.05, 1
57  %cmp = icmp slt i8 %inc, 6
58  br i1 %cmp, label %for.body, label %for.end
59
60for.end:                                          ; preds = %for.inc
61  invoke void @throw()
62          to label %unreachable unwind label %ehcleanup
63
64ehcleanup:                                        ; preds = %for.end, %if.then6.i, %if.then2.i, %call.i.noexc, %for.body
65  %cp = cleanuppad within none []
66  cleanupret from %cp unwind to caller
67
68; CHECK: cleanuppad
69; CHECK-NOT: cleanuppad
70
71unreachable:                                      ; preds = %for.end
72  unreachable
73}
74
75declare i32 @__CxxFrameHandler3(...)
76
77declare void @throw()
78