1 ; RUN: llc -mtriple=i686-pc-windows-msvc < %s | FileCheck --check-prefix=X86 %s
2 ; RUN: llc -mtriple=x86_64-pc-windows-msvc < %s | FileCheck --check-prefix=X64 %s
4 %struct.Dtor = type { i8 }
6 define void @simple_cleanup() #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
8 %o = alloca %struct.Dtor, align 1
10 to label %invoke.cont unwind label %ehcleanup
12 invoke.cont: ; preds = %entry
13 call x86_thiscallcc void @"\01??1Dtor@@QAE@XZ"(%struct.Dtor* %o) #2
16 ehcleanup: ; preds = %entry
18 call x86_thiscallcc void @"\01??1Dtor@@QAE@XZ"(%struct.Dtor* %o) #2
19 cleanupret %0 unwind to caller
22 declare void @f(i32) #0
24 declare i32 @__CxxFrameHandler3(...)
26 ; Function Attrs: nounwind
27 declare x86_thiscallcc void @"\01??1Dtor@@QAE@XZ"(%struct.Dtor*) #1
29 define void @nested_cleanup() #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
31 %o1 = alloca %struct.Dtor, align 1
32 %o2 = alloca %struct.Dtor, align 1
34 to label %invoke.cont unwind label %cleanup.outer
36 invoke.cont: ; preds = %entry
38 to label %invoke.cont.1 unwind label %cleanup.inner
40 invoke.cont.1: ; preds = %invoke.cont
41 call x86_thiscallcc void @"\01??1Dtor@@QAE@XZ"(%struct.Dtor* %o2) #2
43 to label %invoke.cont.2 unwind label %cleanup.outer
45 invoke.cont.2: ; preds = %invoke.cont.1
46 call x86_thiscallcc void @"\01??1Dtor@@QAE@XZ"(%struct.Dtor* %o1) #2
49 cleanup.inner: ; preds = %invoke.cont
51 call x86_thiscallcc void @"\01??1Dtor@@QAE@XZ"(%struct.Dtor* %o2) #2
52 cleanupret %0 unwind label %cleanup.outer
54 cleanup.outer: ; preds = %invoke.cont.1, %cleanup.inner, %entry
56 call x86_thiscallcc void @"\01??1Dtor@@QAE@XZ"(%struct.Dtor* %o1) #2
57 cleanupret %1 unwind to caller
60 ; X86-LABEL: _nested_cleanup:
61 ; X86: movl $1, (%esp)
63 ; X86: movl $2, (%esp)
65 ; X86: movl $3, (%esp)
68 ; X86: LBB1_[[cleanup_inner:[0-9]+]]: # %cleanup.inner
70 ; X86: leal {{.*}}(%ebp), %ecx
71 ; X86: calll "??1Dtor@@QAE@XZ"
75 ; X86: LBB1_[[cleanup_outer:[0-9]+]]: # %cleanup.outer
77 ; X86: leal {{.*}}(%ebp), %ecx
78 ; X86: calll "??1Dtor@@QAE@XZ"
82 ; X86: L__ehtable$nested_cleanup:
83 ; X86: .long 429065506
85 ; X86: .long ($stateUnwindMap$nested_cleanup)
92 ; X86: $stateUnwindMap$nested_cleanup:
94 ; X86: .long LBB1_[[cleanup_outer]]
96 ; X86: .long LBB1_[[cleanup_inner]]
98 ; X64-LABEL: nested_cleanup:
107 ; X64: callq "??1Dtor@@QAE@XZ"
113 ; X64: .LBB1_[[cleanup_inner:[0-9]+]]: # %cleanup.inner
115 ; X64: leaq {{.*}}(%rbp), %rcx
116 ; X64: callq "??1Dtor@@QAE@XZ"
120 ; X64: .LBB1_[[cleanup_outer:[0-9]+]]: # %cleanup.outer
122 ; X64: leaq {{.*}}(%rbp), %rcx
123 ; X64: callq "??1Dtor@@QAE@XZ"
127 ; X64: .seh_handlerdata
128 ; X64-NEXT: .long ($cppxdata$nested_cleanup)@IMGREL
130 ; X64: $cppxdata$nested_cleanup:
131 ; X64-NEXT: .long 429065506
133 ; X64-NEXT: .long ($stateUnwindMap$nested_cleanup)@IMGREL
137 ; X64-NEXT: .long ($ip2state$nested_cleanup)@IMGREL
142 ; X64: $stateUnwindMap$nested_cleanup:
144 ; X64-NEXT: .long .LBB1_[[cleanup_outer]]@IMGREL
146 ; X64-NEXT: .long .LBB1_[[cleanup_inner]]@IMGREL
148 ; X64: $ip2state$nested_cleanup:
149 ; X64-NEXT: .long .Lfunc_begin1@IMGREL
151 ; X64-NEXT: .long .Ltmp8@IMGREL
153 ; X64-NEXT: .long .Ltmp10@IMGREL
155 ; X64-NEXT: .long .Ltmp12@IMGREL
157 ; X64-NEXT: .long .Ltmp13@IMGREL+1
160 attributes #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" }
161 attributes #1 = { 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" }
162 attributes #2 = { nounwind }