xref: /llvm-project/llvm/test/CodeGen/X86/wineh-exceptionpointer.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; RUN: llc -mtriple=x86_64-pc-windows-coreclr < %s | FileCheck %s
2
3declare void @ProcessCLRException()
4declare ptr addrspace(1) @llvm.eh.exceptionpointer.p1(token)
5declare void @f()
6declare void @g(ptr addrspace(1))
7
8; CHECK-LABEL: test1: # @test1
9define void @test1() personality ptr @ProcessCLRException {
10entry:
11  invoke void @f()
12    to label %exit unwind label %catch.pad
13catch.pad:
14  %cs1 = catchswitch within none [label %catch.body] unwind to caller
15catch.body:
16  ; CHECK: {{^[^: ]+}}: # %catch.body
17  ; CHECK: movq %rdx, %rcx
18  ; CHECK-NEXT: callq g
19  %catch = catchpad within %cs1 [i32 5]
20  %exn = call ptr addrspace(1) @llvm.eh.exceptionpointer.p1(token %catch)
21  call void @g(ptr addrspace(1) %exn) [ "funclet"(token %catch) ]
22  catchret from %catch to label %exit
23exit:
24  ret void
25}
26