1 ; RUN: llc < %s -mtriple=x86_64-windows-msvc | FileCheck %s
3 %struct.MakeCleanup = type { i8 }
4 %eh.ThrowInfo = type { i32, i32, i32, i32 }
6 ; Function Attrs: noinline nounwind optnone uwtable
7 define dso_local i32 @foo() {
9 %call = call i32 @cond()
10 %tobool = icmp ne i32 %call, 0
11 br i1 %tobool, label %if.then, label %if.end
13 if.then: ; preds = %entry
17 if.end: ; preds = %entry
18 %call1 = call i32 @cond()
19 %tobool2 = icmp ne i32 %call1, 0
20 br i1 %tobool2, label %if.then3, label %if.end4
22 if.then3: ; preds = %if.end
26 if.end4: ; preds = %if.end
27 %call5 = call i32 @cond()
28 %tobool6 = icmp ne i32 %call5, 0
29 br i1 %tobool6, label %if.then7, label %if.end8
31 if.then7: ; preds = %if.end4
35 if.end8: ; preds = %if.end4
43 ; We don't need int3's between these calls to abort, since they won't confuse
46 ; CHECK-NEXT: # %if.then3
48 ; CHECK-NEXT: # %if.then7
52 declare dso_local i32 @cond()
54 declare dso_local void @abort1() noreturn
55 declare dso_local void @abort2() noreturn
56 declare dso_local void @abort3() noreturn
58 define dso_local void @throw_exception() uwtable personality ptr @__CxxFrameHandler3 {
60 %o = alloca %struct.MakeCleanup, align 1
61 %call = invoke i32 @cond()
62 to label %invoke.cont unwind label %ehcleanup
64 invoke.cont: ; preds = %entry
65 %cmp1 = icmp eq i32 0, %call
66 br i1 %cmp1, label %if.then, label %if.end
68 if.then: ; preds = %invoke.cont
69 invoke void @_CxxThrowException(ptr null, ptr null)
70 to label %unreachable unwind label %ehcleanup
72 if.end: ; preds = %invoke.cont
73 %call2 = invoke i32 @cond()
74 to label %invoke.cont1 unwind label %ehcleanup
76 invoke.cont1: ; preds = %if.end
77 %cmp2 = icmp eq i32 0, %call2
78 br i1 %cmp2, label %if.then3, label %if.end4
80 if.then3: ; preds = %invoke.cont1
81 invoke void @_CxxThrowException(ptr null, ptr null)
82 to label %unreachable unwind label %ehcleanup
84 if.end4: ; preds = %invoke.cont1
85 call void @"??1MakeCleanup@@QEAA@XZ"(ptr nonnull %o)
88 ehcleanup: ; preds = %if.then3, %if.end, %if.then, %entry
89 %cp = cleanuppad within none []
90 call void @"??1MakeCleanup@@QEAA@XZ"(ptr nonnull %o) [ "funclet"(token %cp) ]
91 cleanupret from %cp unwind to caller
93 unreachable: ; preds = %if.then3, %if.then
97 declare dso_local i32 @__CxxFrameHandler3(...)
98 declare dso_local void @_CxxThrowException(ptr, ptr)
99 declare dso_local void @"??1MakeCleanup@@QEAA@XZ"(ptr)
101 ; CHECK-LABEL: throw_exception:
107 ; CHECK: callq _CxxThrowException
108 ; CHECK-NOT: {{(addq|subq) .*, %rsp}}
109 ; CHECK: callq _CxxThrowException
110 ; CHECK-NOT: {{(addq|subq) .*, %rsp}}
111 ; CHECK: # %unreachable
113 ; CHECK: .seh_handlerdata