xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/seh-finally.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s --check-prefix=X64
2*9880d681SAndroid Build Coastguard Worker; RUN: sed -e 's/__C_specific_handler/_except_handler3/' %s | \
3*9880d681SAndroid Build Coastguard Worker; RUN:        llc -mtriple=i686-windows-msvc | FileCheck %s --check-prefix=X86
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Worker@str_recovered = internal unnamed_addr constant [10 x i8] c"recovered\00", align 1
6*9880d681SAndroid Build Coastguard Worker
7*9880d681SAndroid Build Coastguard Workerdeclare void @crash()
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Workerdefine i32 @main() personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*) {
10*9880d681SAndroid Build Coastguard Workerentry:
11*9880d681SAndroid Build Coastguard Worker  invoke void @crash()
12*9880d681SAndroid Build Coastguard Worker          to label %invoke.cont unwind label %lpad
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Workerinvoke.cont:                                      ; preds = %entry
15*9880d681SAndroid Build Coastguard Worker  %call = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str_recovered, i64 0, i64 0))
16*9880d681SAndroid Build Coastguard Worker  call void @abort()
17*9880d681SAndroid Build Coastguard Worker  ret i32 0
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Workerlpad:                                             ; preds = %entry
20*9880d681SAndroid Build Coastguard Worker  %p = cleanuppad within none []
21*9880d681SAndroid Build Coastguard Worker  %call2 = call i32 @puts(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str_recovered, i64 0, i64 0)) [ "funclet"(token %p) ]
22*9880d681SAndroid Build Coastguard Worker  cleanupret from %p unwind to caller
23*9880d681SAndroid Build Coastguard Worker}
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Worker; X64-LABEL: main:
26*9880d681SAndroid Build Coastguard Worker; X64: retq
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Worker; X64: .seh_handlerdata
29*9880d681SAndroid Build Coastguard Worker; X64-NEXT: .Lmain$parent_frame_offset = 32
30*9880d681SAndroid Build Coastguard Worker; X64-NEXT: .long   (.Llsda_end0-.Llsda_begin0)/16 # Number of call sites
31*9880d681SAndroid Build Coastguard Worker; X64-NEXT: .Llsda_begin0:
32*9880d681SAndroid Build Coastguard Worker; X64-NEXT: .long   .Ltmp0@IMGREL+1 # LabelStart
33*9880d681SAndroid Build Coastguard Worker; X64-NEXT: .long   .Ltmp1@IMGREL+1 # LabelEnd
34*9880d681SAndroid Build Coastguard Worker; X64-NEXT: .long   "?dtor$2@?0?main@4HA"@IMGREL # FinallyFunclet
35*9880d681SAndroid Build Coastguard Worker; X64-NEXT: .long   0               # Null
36*9880d681SAndroid Build Coastguard Worker; X64-NEXT: .Llsda_end0:
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Worker; X64-LABEL: "?dtor$2@?0?main@4HA":
39*9880d681SAndroid Build Coastguard Worker; X64: callq puts
40*9880d681SAndroid Build Coastguard Worker; X64: retq
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Worker; X86-LABEL: _main:
43*9880d681SAndroid Build Coastguard Worker; X86: retl
44*9880d681SAndroid Build Coastguard Worker
45*9880d681SAndroid Build Coastguard Worker; X86-LABEL: "?dtor$2@?0?main@4HA":
46*9880d681SAndroid Build Coastguard Worker; X86: LBB0_2:
47*9880d681SAndroid Build Coastguard Worker; X86: calll _puts
48*9880d681SAndroid Build Coastguard Worker; X86: retl
49*9880d681SAndroid Build Coastguard Worker
50*9880d681SAndroid Build Coastguard Worker; X86: .section .xdata,"dr"
51*9880d681SAndroid Build Coastguard Worker; X86: L__ehtable$main:
52*9880d681SAndroid Build Coastguard Worker; X86-NEXT: .long -1 # ToState
53*9880d681SAndroid Build Coastguard Worker; X86-NEXT: .long 0  # Null
54*9880d681SAndroid Build Coastguard Worker; X86-NEXT: .long "?dtor$2@?0?main@4HA" # FinallyFunclet
55*9880d681SAndroid Build Coastguard Worker
56*9880d681SAndroid Build Coastguard Workerdeclare i32 @__C_specific_handler(...)
57*9880d681SAndroid Build Coastguard Worker
58*9880d681SAndroid Build Coastguard Workerdeclare i32 @puts(i8*)
59*9880d681SAndroid Build Coastguard Worker
60*9880d681SAndroid Build Coastguard Workerdeclare void @abort()
61