81 lines · plain
1; RUN: llc -mtriple=i686-pc-windows-msvc -stack-symbol-ordering=0 < %s | FileCheck --check-prefix=X86 %s2; RUN: llc -mtriple=x86_64-pc-windows-msvc -stack-symbol-ordering=0 < %s | FileCheck --check-prefix=X64 %s3 4declare i32 @__CxxFrameHandler3(...)5declare void @Dtor(ptr %o)6declare void @f(i32)7 8define void @realigned_cleanup() personality ptr @__CxxFrameHandler3 {9entry:10 ; Overalign %o to cause stack realignment.11 %o = alloca i64, align 3212 invoke void @f(i32 1)13 to label %invoke.cont unwind label %ehcleanup14 15invoke.cont: ; preds = %entry16 call void @Dtor(ptr %o)17 ret void18 19ehcleanup: ; preds = %entry20 %0 = cleanuppad within none []21 call void @Dtor(ptr %o) [ "funclet"(token %0) ]22 cleanupret from %0 unwind to caller23}24 25; X86-LABEL: _realigned_cleanup: # @realigned_cleanup26; X86: pushl %ebp27; X86: movl %esp, %ebp28; X86: pushl %ebx29; X86: pushl %edi30; X86: pushl %esi31; X86: andl $-32, %esp32; X86: subl $96, %esp33; X86: movl %esp, %esi34; EBP will reload from this offset.35; X86: movl %ebp, 28(%esi)36; The last EH reg field is the state number, so dtor adjust is this +4.37; X86: movl $-1, 72(%esi)38 39; X86-LABEL: "?dtor$2@?0?realigned_cleanup@4HA":40; X86: pushl %ebp41; X86: leal -76(%ebp), %esi42; X86: movl 28(%esi), %ebp43; We used to have a bug where we clobbered ESI after the prologue.44; X86-NOT: movl {{.*}}, %esi45; X86: popl %ebp46; X86: retl # CLEANUPRET47 48; X64-LABEL: realigned_cleanup: # @realigned_cleanup49; X64: pushq %rbp50; X64: .seh_pushreg %rbp51; X64: pushq %rbx52; X64: .seh_pushreg %rbx53; X64: subq $104, %rsp54; X64: .seh_stackalloc 10455; X64: leaq 96(%rsp), %rbp56; X64: .seh_setframe %rbp, 9657; X64: .seh_endprologue58; X64: andq $-32, %rsp59; X64: movq %rsp, %rbx60; RBP will reload from this offset.61; X64: movq %rbp, 56(%rbx)62; X64: movq $-2, (%rbp)63 64; X64-LABEL: "?dtor$2@?0?realigned_cleanup@4HA":65; X64: movq %rdx, 16(%rsp)66; X64: pushq %rbp67; X64: .seh_pushreg %rbp68; X64: pushq %rbx69; X64: .seh_pushreg %rbx70; X64: subq $40, %rsp71; X64: .seh_stackalloc 4072; X64: leaq 96(%rdx), %rbp73; X64: .seh_endprologue74; X64: andq $-32, %rdx75; X64: movq %rdx, %rbx76; X64-NOT: mov{{.*}}, %rbx77; X64: .seh_startepilogue78; X64: popq %rbp79; X64: .seh_endepilogue80; X64: retq # CLEANUPRET81