xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/win32-seh-nested-finally.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
4*9880d681SAndroid Build Coastguard Workertarget triple = "i686-pc-windows-msvc"
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdefine void @nested_finally() #0 personality i8* bitcast (i32 (...)* @_except_handler3 to i8*) {
7*9880d681SAndroid Build Coastguard Workerentry:
8*9880d681SAndroid Build Coastguard Worker  invoke void @f(i32 1) #3
9*9880d681SAndroid Build Coastguard Worker          to label %invoke.cont unwind label %ehcleanup
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Workerinvoke.cont:                                      ; preds = %entry
12*9880d681SAndroid Build Coastguard Worker  invoke void @f(i32 2) #3
13*9880d681SAndroid Build Coastguard Worker          to label %invoke.cont.1 unwind label %ehcleanup.3
14*9880d681SAndroid Build Coastguard Worker
15*9880d681SAndroid Build Coastguard Workerinvoke.cont.1:                                    ; preds = %invoke.cont
16*9880d681SAndroid Build Coastguard Worker  call void @f(i32 3) #3
17*9880d681SAndroid Build Coastguard Worker  ret void
18*9880d681SAndroid Build Coastguard Worker
19*9880d681SAndroid Build Coastguard Workerehcleanup:                                        ; preds = %entry
20*9880d681SAndroid Build Coastguard Worker  %0 = cleanuppad within none []
21*9880d681SAndroid Build Coastguard Worker  invoke void @f(i32 2) #3 [ "funclet"(token %0) ]
22*9880d681SAndroid Build Coastguard Worker          to label %invoke.cont.2 unwind label %ehcleanup.3
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Workerinvoke.cont.2:                                    ; preds = %ehcleanup
25*9880d681SAndroid Build Coastguard Worker  cleanupret from %0 unwind label %ehcleanup.3
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerehcleanup.3:                                      ; preds = %invoke.cont.2, %ehcleanup.end, %invoke.cont
28*9880d681SAndroid Build Coastguard Worker  %1 = cleanuppad within none []
29*9880d681SAndroid Build Coastguard Worker  call void @f(i32 3) #3 [ "funclet"(token %1) ]
30*9880d681SAndroid Build Coastguard Worker  cleanupret from %1 unwind to caller
31*9880d681SAndroid Build Coastguard Worker}
32*9880d681SAndroid Build Coastguard Worker
33*9880d681SAndroid Build Coastguard Workerdeclare void @f(i32) #0
34*9880d681SAndroid Build Coastguard Worker
35*9880d681SAndroid Build Coastguard Workerdeclare i32 @_except_handler3(...)
36*9880d681SAndroid Build Coastguard Worker
37*9880d681SAndroid Build Coastguard Workerattributes #0 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
38*9880d681SAndroid Build Coastguard Workerattributes #1 = { noinline nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
39*9880d681SAndroid Build Coastguard Workerattributes #2 = { nounwind readnone }
40*9880d681SAndroid Build Coastguard Workerattributes #3 = { noinline }
41*9880d681SAndroid Build Coastguard Worker
42*9880d681SAndroid Build Coastguard Worker; CHECK: _nested_finally:
43*9880d681SAndroid Build Coastguard Worker; CHECK: movl $-1, -[[state:[0-9]+]](%ebp)
44*9880d681SAndroid Build Coastguard Worker; CHECK: movl {{.*}}, %fs:0
45*9880d681SAndroid Build Coastguard Worker; CHECK: movl $1, -[[state]](%ebp)
46*9880d681SAndroid Build Coastguard Worker; CHECK: pushl $1
47*9880d681SAndroid Build Coastguard Worker; CHECK: calll _f
48*9880d681SAndroid Build Coastguard Worker; CHECK: addl $4, %esp
49*9880d681SAndroid Build Coastguard Worker; CHECK: movl $0, -[[state]](%ebp)
50*9880d681SAndroid Build Coastguard Worker; CHECK: pushl $2
51*9880d681SAndroid Build Coastguard Worker; CHECK: calll _f
52*9880d681SAndroid Build Coastguard Worker; CHECK: addl $4, %esp
53*9880d681SAndroid Build Coastguard Worker; CHECK: movl $-1, -[[state]](%ebp)
54*9880d681SAndroid Build Coastguard Worker; CHECK: pushl $3
55*9880d681SAndroid Build Coastguard Worker; CHECK: calll _f
56*9880d681SAndroid Build Coastguard Worker; CHECK: addl $4, %esp
57*9880d681SAndroid Build Coastguard Worker; CHECK: retl
58*9880d681SAndroid Build Coastguard Worker
59*9880d681SAndroid Build Coastguard Worker; CHECK: LBB0_[[inner:[0-9]+]]: # %ehcleanup
60*9880d681SAndroid Build Coastguard Worker; CHECK: pushl %ebp
61*9880d681SAndroid Build Coastguard Worker; CHECK: addl $12, %ebp
62*9880d681SAndroid Build Coastguard Worker; CHECK: pushl $2
63*9880d681SAndroid Build Coastguard Worker; CHECK: calll _f
64*9880d681SAndroid Build Coastguard Worker; CHECK: addl $4, %esp
65*9880d681SAndroid Build Coastguard Worker; CHECK: addl $4, %esp
66*9880d681SAndroid Build Coastguard Worker; CHECK: popl %ebp
67*9880d681SAndroid Build Coastguard Worker; CHECK: retl
68*9880d681SAndroid Build Coastguard Worker
69*9880d681SAndroid Build Coastguard Worker; CHECK: LBB0_[[outer:[0-9]+]]: # %ehcleanup.3
70*9880d681SAndroid Build Coastguard Worker; CHECK: pushl %ebp
71*9880d681SAndroid Build Coastguard Worker; CHECK: addl $12, %ebp
72*9880d681SAndroid Build Coastguard Worker; CHECK: pushl $3
73*9880d681SAndroid Build Coastguard Worker; CHECK: calll _f
74*9880d681SAndroid Build Coastguard Worker; CHECK: addl $8, %esp
75*9880d681SAndroid Build Coastguard Worker; CHECK: popl %ebp
76*9880d681SAndroid Build Coastguard Worker; CHECK: retl
77*9880d681SAndroid Build Coastguard Worker
78*9880d681SAndroid Build Coastguard Worker; CHECK: L__ehtable$nested_finally:
79*9880d681SAndroid Build Coastguard Worker; CHECK:        .long   -1 # ToState
80*9880d681SAndroid Build Coastguard Worker; CHECK:        .long   0  # Null
81*9880d681SAndroid Build Coastguard Worker; CHECK:        .long   "?dtor$[[outer]]@?0?nested_finally@4HA" # FinallyFunclet
82*9880d681SAndroid Build Coastguard Worker; CHECK:        .long   0  # ToState
83*9880d681SAndroid Build Coastguard Worker; CHECK:        .long   0  # Null
84*9880d681SAndroid Build Coastguard Worker; CHECK:        .long   "?dtor$[[inner]]@?0?nested_finally@4HA" # FinallyFunclet
85