From dcc1291d17234eb623da310e2bb4586d0a39623e Mon Sep 17 00:00:00 2001 From: Alexey Samsonov Date: Mon, 16 Jul 2012 06:54:09 +0000 Subject: This CL changes the function prologue and epilogue emitted on X86 when stack needs realignment. It is intended to fix PR11468. Old prologue and epilogue looked like this: push %rbp mov %rsp, %rbp and $alignment, %rsp push %r14 push %r15 ... pop %r15 pop %r14 mov %rbp, %rsp pop %rbp The problem was to reference the locations of callee-saved registers in exception handling: locations of callee-saved had to be re-calculated regarding the stack alignment operation. It would take some effort to implement this in LLVM, as currently MachineLocation can only have the form "Register + Offset". Funciton prologue and epilogue are now changed to: push %rbp mov %rsp, %rbp push %14 push %15 and $alignment, %rsp ... lea -$size_of_saved_registers(%rbp), %rsp pop %r15 pop %r14 pop %rbp Reviewed by Chad Rosier. llvm-svn: 160248 --- llvm/test/CodeGen/X86/dynamic-allocas-VLAs.ll | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'llvm/test/CodeGen/X86/dynamic-allocas-VLAs.ll') diff --git a/llvm/test/CodeGen/X86/dynamic-allocas-VLAs.ll b/llvm/test/CodeGen/X86/dynamic-allocas-VLAs.ll index c7970d491ee..54ae39b7112 100644 --- a/llvm/test/CodeGen/X86/dynamic-allocas-VLAs.ll +++ b/llvm/test/CodeGen/X86/dynamic-allocas-VLAs.ll @@ -85,20 +85,19 @@ entry: ; CHECK: _t4 ; CHECK: pushq %rbp ; CHECK: movq %rsp, %rbp -; CHECK: andq $-32, %rsp ; CHECK: pushq %r14 ; CHECK: pushq %rbx -; CHECK: subq $[[STACKADJ:[0-9]+]], %rsp +; CHECK: andq $-32, %rsp +; CHECK: subq ${{[0-9]+}}, %rsp ; CHECK: movq %rsp, %rbx ; ; CHECK: leaq {{[0-9]*}}(%rbx), %rdi ; CHECK: leaq {{[0-9]*}}(%rbx), %rdx ; CHECK: callq _t4_helper ; -; CHECK: addq $[[STACKADJ]], %rsp +; CHECK: leaq -16(%rbp), %rsp ; CHECK: popq %rbx ; CHECK: popq %r14 -; CHECK: movq %rbp, %rsp ; CHECK: popq %rbp } @@ -176,19 +175,17 @@ entry: ; CHECK: _t7 ; CHECK: pushq %rbp ; CHECK: movq %rsp, %rbp -; CHECK: andq $-32, %rsp ; CHECK: pushq %rbx -; CHECK: subq $[[ADJ:[0-9]+]], %rsp +; CHECK: andq $-32, %rsp +; CHECK: subq ${{[0-9]+}}, %rsp ; CHECK: movq %rsp, %rbx ; Stack adjustment for byval ; CHECK: subq {{.*}}, %rsp ; CHECK: callq _bar ; CHECK-NOT: addq {{.*}}, %rsp -; CHECK: movq %rbx, %rsp -; CHECK: addq $[[ADJ]], %rsp +; CHECK: leaq -8(%rbp), %rsp ; CHECK: popq %rbx -; CHECK: movq %rbp, %rsp ; CHECK: popq %rbp } @@ -229,14 +226,12 @@ entry: ; FORCE-ALIGN: _t9 ; FORCE-ALIGN: pushq %rbp ; FORCE-ALIGN: movq %rsp, %rbp -; FORCE-ALIGN: andq $-32, %rsp ; FORCE-ALIGN: pushq %rbx -; FORCE-ALIGN: subq $24, %rsp +; FORCE-ALIGN: andq $-32, %rsp +; FORCE-ALIGN: subq $32, %rsp ; FORCE-ALIGN: movq %rsp, %rbx -; FORCE-ALIGN: movq %rbx, %rsp -; FORCE-ALIGN: addq $24, %rsp +; FORCE-ALIGN: leaq -8(%rbp), %rsp ; FORCE-ALIGN: popq %rbx -; FORCE-ALIGN: movq %rbp, %rsp ; FORCE-ALIGN: popq %rbp } -- cgit v1.2.3