xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/wineh-exceptionpointer.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=x86_64-pc-windows-coreclr < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Workerdeclare void @ProcessCLRException()
4*9880d681SAndroid Build Coastguard Workerdeclare i8 addrspace(1)* @llvm.eh.exceptionpointer.p1i8(token)
5*9880d681SAndroid Build Coastguard Workerdeclare void @f()
6*9880d681SAndroid Build Coastguard Workerdeclare void @g(i32 addrspace(1)*)
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test1: # @test1
9*9880d681SAndroid Build Coastguard Workerdefine void @test1() personality i8* bitcast (void ()* @ProcessCLRException to i8*) {
10*9880d681SAndroid Build Coastguard Workerentry:
11*9880d681SAndroid Build Coastguard Worker  invoke void @f()
12*9880d681SAndroid Build Coastguard Worker    to label %exit unwind label %catch.pad
13*9880d681SAndroid Build Coastguard Workercatch.pad:
14*9880d681SAndroid Build Coastguard Worker  %cs1 = catchswitch within none [label %catch.body] unwind to caller
15*9880d681SAndroid Build Coastguard Workercatch.body:
16*9880d681SAndroid Build Coastguard Worker  ; CHECK: {{^[^: ]+}}: # %catch.body
17*9880d681SAndroid Build Coastguard Worker  ; CHECK: movq %rdx, %rcx
18*9880d681SAndroid Build Coastguard Worker  ; CHECK-NEXT: callq g
19*9880d681SAndroid Build Coastguard Worker  %catch = catchpad within %cs1 [i32 5]
20*9880d681SAndroid Build Coastguard Worker  %exn = call i8 addrspace(1)* @llvm.eh.exceptionpointer.p1i8(token %catch)
21*9880d681SAndroid Build Coastguard Worker  %cast_exn = bitcast i8 addrspace(1)* %exn to i32 addrspace(1)*
22*9880d681SAndroid Build Coastguard Worker  call void @g(i32 addrspace(1)* %cast_exn) [ "funclet"(token %catch) ]
23*9880d681SAndroid Build Coastguard Worker  catchret from %catch to label %exit
24*9880d681SAndroid Build Coastguard Workerexit:
25*9880d681SAndroid Build Coastguard Worker  ret void
26*9880d681SAndroid Build Coastguard Worker}
27