xref: /aosp_15_r20/external/llvm/test/CodeGen/WinEH/wineh-nested-unwind.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1; RUN: llc < %s | FileCheck %s
2target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
3target triple = "x86_64-pc-windows-msvc18.0.0"
4
5; Function Attrs: uwtable
6define void @f() #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
7entry:
8  invoke void @g()
9          to label %try.cont unwind label %catch.dispatch
10
11catch.dispatch:                                   ; preds = %entry
12  %0 = catchswitch within none [label %catch] unwind label %ehcleanup
13
14catch:                                            ; preds = %catch.dispatch
15  %1 = catchpad within %0 [i8* null, i32 64, i8* null]
16  invoke void @g() [ "funclet"(token %1) ]
17          to label %dtor.exit unwind label %catch.dispatch.i
18
19catch.dispatch.i:                                 ; preds = %catch
20  %2 = catchswitch within %1 [label %catch.i] unwind to caller
21
22catch.i:                                          ; preds = %catch.dispatch.i
23  %3 = catchpad within %2 [i8* null, i32 64, i8* null]
24  catchret from %3 to label %dtor.exit
25
26dtor.exit:
27  catchret from %1 to label %try.cont
28
29try.cont:
30  ret void
31
32ehcleanup:                                        ; preds = %catch.dispatch
33  %4 = cleanuppad within none []
34  call void @dtor() #1 [ "funclet"(token %4) ]
35  cleanupret from %4 unwind to caller
36}
37
38declare void @g()
39
40declare i32 @__CxxFrameHandler3(...)
41
42; Function Attrs: nounwind
43declare void @dtor() #1
44
45attributes #0 = { uwtable }
46attributes #1 = { nounwind }
47
48; CHECK-LABEL: $ip2state$f:
49; CHECK: -1
50; CHECK: 1
51; CHECK: -1
52; CHECK: 4
53; CHECK: 2
54; CHECK: 3
55; CHECK: 2
56