|
1 | 1 | ; RUN: llc < %s -mtriple=x86_64-windows-msvc | FileCheck %s
|
2 | 2 |
|
| 3 | +%struct.MakeCleanup = type { i8 } |
| 4 | +%eh.ThrowInfo = type { i32, i32, i32, i32 } |
| 5 | + |
3 | 6 | ; Function Attrs: noinline nounwind optnone uwtable
|
4 | 7 | define dso_local i32 @foo() {
|
5 | 8 | entry:
|
@@ -51,3 +54,58 @@ declare dso_local i32 @cond()
|
51 | 54 | declare dso_local void @abort1() noreturn
|
52 | 55 | declare dso_local void @abort2() noreturn
|
53 | 56 | declare dso_local void @abort3() noreturn
|
| 57 | + |
| 58 | +define dso_local void @throw_exception() uwtable personality i32 (...)* @__CxxFrameHandler3 { |
| 59 | +entry: |
| 60 | + %o = alloca %struct.MakeCleanup, align 1 |
| 61 | + %call = invoke i32 @cond() |
| 62 | + to label %invoke.cont unwind label %ehcleanup |
| 63 | + |
| 64 | +invoke.cont: ; preds = %entry |
| 65 | + %cmp1 = icmp eq i32 0, %call |
| 66 | + br i1 %cmp1, label %if.then, label %if.end |
| 67 | + |
| 68 | +if.then: ; preds = %invoke.cont |
| 69 | + invoke void @_CxxThrowException(i8* null, %eh.ThrowInfo* null) |
| 70 | + to label %unreachable unwind label %ehcleanup |
| 71 | + |
| 72 | +if.end: ; preds = %invoke.cont |
| 73 | + %call2 = invoke i32 @cond() |
| 74 | + to label %invoke.cont1 unwind label %ehcleanup |
| 75 | + |
| 76 | +invoke.cont1: ; preds = %if.end |
| 77 | + %cmp2 = icmp eq i32 0, %call2 |
| 78 | + br i1 %cmp2, label %if.then3, label %if.end4 |
| 79 | + |
| 80 | +if.then3: ; preds = %invoke.cont1 |
| 81 | + invoke void @_CxxThrowException(i8* null, %eh.ThrowInfo* null) |
| 82 | + to label %unreachable unwind label %ehcleanup |
| 83 | + |
| 84 | +if.end4: ; preds = %invoke.cont1 |
| 85 | + call void @"??1MakeCleanup@@QEAA@XZ"(%struct.MakeCleanup* nonnull %o) |
| 86 | + ret void |
| 87 | + |
| 88 | +ehcleanup: ; preds = %if.then3, %if.end, %if.then, %entry |
| 89 | + %cp = cleanuppad within none [] |
| 90 | + call void @"??1MakeCleanup@@QEAA@XZ"(%struct.MakeCleanup* nonnull %o) [ "funclet"(token %cp) ] |
| 91 | + cleanupret from %cp unwind to caller |
| 92 | + |
| 93 | +unreachable: ; preds = %if.then3, %if.then |
| 94 | + unreachable |
| 95 | +} |
| 96 | + |
| 97 | +declare dso_local i32 @__CxxFrameHandler3(...) |
| 98 | +declare dso_local void @_CxxThrowException(i8*, %eh.ThrowInfo*) |
| 99 | +declare dso_local void @"??1MakeCleanup@@QEAA@XZ"(%struct.MakeCleanup*) |
| 100 | + |
| 101 | +; CHECK-LABEL: throw_exception: |
| 102 | +; CHECK: callq cond |
| 103 | +; CHECK: je |
| 104 | +; CHECK: callq cond |
| 105 | +; CHECK: je |
| 106 | +; CHECK: retq |
| 107 | +; CHECK: callq _CxxThrowException |
| 108 | +; CHECK-NOT: {{(addq|subq) .*, %rsp}} |
| 109 | +; CHECK: callq _CxxThrowException |
| 110 | +; CHECK-NOT: {{(addq|subq) .*, %rsp}} |
| 111 | +; CHECK: .seh_handlerdata |
0 commit comments