1 ; RUN: llc < %s | FileCheck %s
2 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
3 target triple = "x86_64-pc-windows-msvc"
5 define void @test1(i64* %result.repack) personality i32 (...)* @__CxxFrameHandler3 {
7 invoke void @may_throw(i32 1)
8 to label %postinvoke unwind label %cleanuppad
10 ; CHECK: callq may_throw
12 postinvoke: ; preds = %bb
13 store i64 19, i64* %result.repack, align 8
15 ; CHECK: movq $19, (%rsi)
16 ; CHECK: movl $2, %ecx
17 ; CHECK-NEXT: movq %rsi, -8(%rbp)
18 ; CHECK-NEXT: callq may_throw
19 invoke void @may_throw(i32 2)
20 to label %assertFailed unwind label %catch.dispatch
22 catch.dispatch: ; preds = %cleanuppad9, %postinvoke
23 %tmp3 = catchswitch within none [label %catch.object.Throwable] unwind label %cleanuppad
25 catch.object.Throwable: ; preds = %catch.dispatch
26 %tmp2 = catchpad within %tmp3 [i8* null, i32 64, i8* null]
27 catchret from %tmp2 to label %catchhandler
29 catchhandler: ; preds = %catch.object.Throwable
30 invoke void @may_throw(i32 3)
31 to label %try.success.or.caught unwind label %cleanuppad
33 try.success.or.caught: ; preds = %catchhandler
34 invoke void @may_throw(i32 4)
35 to label %postinvoke27 unwind label %cleanuppad24
36 ; CHECK: movl $4, %ecx
37 ; CHECK-NEXT: callq may_throw
39 postinvoke27: ; preds = %try.success.or.caught
40 store i64 42, i64* %result.repack, align 8
41 ; CHECK: movq -8(%rbp), %[[reload:r..]]
42 ; CHECK-NEXT: movq $42, (%[[reload]])
45 cleanuppad24: ; preds = %try.success.or.caught
46 %tmp5 = cleanuppad within none []
47 cleanupret from %tmp5 unwind to caller
49 cleanuppad: ; preds = %catchhandler, %catch.dispatch, %bb
50 %tmp1 = cleanuppad within none []
51 cleanupret from %tmp1 unwind to caller
53 assertFailed: ; preds = %postinvoke
54 invoke void @may_throw(i32 5)
55 to label %postinvoke13 unwind label %cleanuppad9
57 postinvoke13: ; preds = %assertFailed
60 cleanuppad9: ; preds = %assertFailed
61 %tmp4 = cleanuppad within none []
62 cleanupret from %tmp4 unwind label %catch.dispatch
65 declare void @may_throw(i32)
67 declare i32 @__CxxFrameHandler3(...)