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(ptr %result.repack) personality ptr @__CxxFrameHandler3 {
7 invoke void @may_throw(i32 1)
8 to label %postinvoke unwind label %cleanuppad
9 ; CHECK: movq %rcx, [[SpillLoc:.*\(%rbp\)]]
10 ; CHECK: movl $1, %ecx
11 ; CHECK: callq may_throw
13 postinvoke: ; preds = %bb
14 store i64 19, ptr %result.repack, align 8
15 ; CHECK: movq [[SpillLoc]], [[R1:%r..]]
16 ; CHECK: movq $19, ([[R1]])
17 ; CHECK: movl $2, %ecx
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 [ptr null, i32 64, ptr 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, ptr %result.repack, align 8
41 ; CHECK: movq [[SpillLoc]], [[R2:%r..]]
42 ; CHECK-NEXT: movq $42, ([[R2]])
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(...)