1 ; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s
3 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
4 target triple = "x86_64-pc-windows-msvc"
6 define void @"\01?f@@YAXXZ"(i1 %B) personality i32 (...)* @__CxxFrameHandler3 {
9 to label %unreachable unwind label %cleanupblock
12 %cleanp = cleanuppad within none []
13 call void @g() [ "funclet"(token %cleanp) ]
14 cleanupret from %cleanp unwind label %catch.dispatch
17 %cs1 = catchswitch within none [label %catch] unwind to caller
20 %cp = catchpad within %cs1 [i8* null, i32 64, i8* null]
21 call void @g() [ "funclet"(token %cp) ]
22 catchret from %cp to label %try.cont
34 declare i32 @__CxxFrameHandler3(...)
36 ; Destructors need CFI but they shouldn't use the .seh_handler directive.
37 ; CHECK: "?dtor$[[cleanup:[0-9]+]]@?0??f@@YAXXZ@4HA":
38 ; CHECK: .seh_proc "?dtor$[[cleanup]]@?0??f@@YAXXZ@4HA"
39 ; CHECK-NOT: .seh_handler __CxxFrameHandler3
40 ; CHECK: LBB0_[[cleanup]]: # %cleanupblock{{$}}
42 ; Emit CFI for pushing RBP.
43 ; CHECK: movq %rdx, 16(%rsp)
45 ; CHECK: .seh_pushreg %rbp
47 ; Emit CFI for allocating from the stack pointer.
48 ; CHECK: subq $32, %rsp
49 ; CHECK: .seh_stackalloc 32
51 ; CHECK: leaq 48(%rdx), %rbp
52 ; CHECK-NOT: .seh_setframe
54 ; Prologue is done, emit the .seh_endprologue directive.
55 ; CHECK: .seh_endprologue
57 ; Make sure there is a nop after a call if the call precedes the epilogue.
61 ; Don't emit a reference to the LSDA.
62 ; CHECK: .seh_handlerdata
63 ; CHECK-NOT: .long ("$cppxdata$?f@@YAXXZ")@IMGREL
67 ; CHECK: "?catch$[[catch:[0-9]+]]@?0??f@@YAXXZ@4HA":
68 ; CHECK: .seh_proc "?catch$[[catch]]@?0??f@@YAXXZ@4HA"
69 ; CHECK-NEXT: .seh_handler __CxxFrameHandler3, @unwind, @except
70 ; CHECK: LBB0_[[catch]]: # %catch{{$}}
72 ; Emit CFI for pushing RBP.
73 ; CHECK: movq %rdx, 16(%rsp)
75 ; CHECK: .seh_pushreg %rbp
77 ; Emit CFI for allocating from the stack pointer.
78 ; CHECK: subq $32, %rsp
79 ; CHECK: .seh_stackalloc 32
81 ; CHECK: leaq 48(%rdx), %rbp
82 ; CHECK-NOT: .seh_setframe
84 ; Prologue is done, emit the .seh_endprologue directive.
85 ; CHECK: .seh_endprologue
87 ; Make sure there is at least one instruction after a call before the epilogue.
89 ; CHECK-NEXT: leaq .LBB0_{{[0-9]+}}(%rip), %rax
91 ; Emit a reference to the LSDA.
92 ; CHECK: .seh_handlerdata
93 ; CHECK-NEXT: .long ("$cppxdata$?f@@YAXXZ")@IMGREL