diff options
author | Alexey Samsonov <samsonov@google.com> | 2012-07-16 06:54:09 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2012-07-16 06:54:09 +0000 |
commit | 99a92f269d4ea6f13a9858bb883e13382d021120 (patch) | |
tree | b158cfaac30e00e48d05b2fa0151950bd0df773b /test/CodeGen/X86/dynamic-allocas-VLAs.ll | |
parent | 38f488e46292e38c776dd6ec3e3a0b8c57952fcb (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160248 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/dynamic-allocas-VLAs.ll')
-rw-r--r-- | test/CodeGen/X86/dynamic-allocas-VLAs.ll | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/test/CodeGen/X86/dynamic-allocas-VLAs.ll b/test/CodeGen/X86/dynamic-allocas-VLAs.ll index c7970d491ee..54ae39b7112 100644 --- a/test/CodeGen/X86/dynamic-allocas-VLAs.ll +++ b/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 } |