1 ; RUN: llc -stack-symbol-ordering=0 -mtriple=x86_64-windows-msvc < %s | FileCheck %s --check-prefix=X64
2 ; RUN: llc -stack-symbol-ordering=0 -mtriple=i686-windows-msvc < %s | FileCheck %s --check-prefix=X86
4 declare void @llvm.va_start(ptr)
5 declare void @llvm.va_end(ptr)
6 declare i32 @__CxxFrameHandler3(...)
9 define i32 @f(i32 %a, ...) personality ptr @__CxxFrameHandler3 {
13 to label %return unwind label %catch.dispatch
15 catch.dispatch: ; preds = %entry
16 %cs1 = catchswitch within none [label %catch] unwind to caller
18 catch: ; preds = %catch.dispatch
19 %0 = catchpad within %cs1 [ptr null, i32 64, ptr null]
20 call void @llvm.va_start(ptr %ap)
21 %argp.cur = load ptr, ptr %ap
22 %arg2 = load i32, ptr %argp.cur
23 call void @llvm.va_end(ptr %ap)
24 catchret from %0 to label %return
26 return: ; preds = %entry, %catch
27 %retval.0 = phi i32 [ %arg2, %catch ], [ -1, %entry ]
31 ; X64-LABEL: .seh_proc f
34 ; X64: leaq 64(%rsp), %rbp
35 ; X64: movq $-2, -8(%rbp)
36 ; X64: movl $-1, -20(%rbp) # 4-byte Folded Spill
39 ; X64: movl -20(%rbp), %eax # 4-byte Reload
43 ; X64-LABEL: "?catch${{[0-9]}}@?0?f@4HA":
44 ; X64: .seh_proc "?catch${{[0-9]}}@?0?f@4HA"
45 ; X64: movq %rdx, 16(%rsp)
48 ; X64: leaq 64(%rdx), %rbp
57 ; X64: movl 24(%rbp), %eax
58 ; X64: movl %eax, -20(%rbp) # 4-byte Spill
59 ; X64: leaq .LBB0_1(%rip), %rax
62 ; X64: retq # CATCHRET
66 ; X86: movl %esp, %ebp
71 ; X86: movl $-1, -36(%ebp)
73 ; X86: LBB0_[[retbb:[0-9]+]]:
74 ; X86: movl -36(%ebp), %eax
82 ; X86: LBB0_[[restorebb:[0-9]+]]: # Block address taken
84 ; arg2 is at EBP offset 12:
88 ; X86: movl 12(%ebp), %eax
89 ; X86: movl %eax, -36(%ebp)
90 ; X86: jmp LBB0_[[retbb]]
92 ; X86-LABEL: "?catch${{[0-9]}}@?0?f@4HA":
95 ; Done due to mov %esp, %ebp
96 ; X86: leal 12(%ebp), %eax
97 ; X86: movl $LBB0_[[restorebb]], %eax
99 ; X86: retl # CATCHRET