Use pushq / popq instead of subq $8, %rsp / addq $8, %rsp to adjust stack in
prologue and epilogue if the adjustment is 8. Similarly, use pushl / popl if
the adjustment is 4 in 32-bit mode.
In the epilogue, takes care to pop to a caller-saved register that's not live
at the exit (either return or tailcall instruction).
rdar://8771137
llvm-svn: 122783
diff --git a/llvm/test/CodeGen/X86/tailcall-largecode.ll b/llvm/test/CodeGen/X86/tailcall-largecode.ll
index c7070f2..c3f4278 100644
--- a/llvm/test/CodeGen/X86/tailcall-largecode.ll
+++ b/llvm/test/CodeGen/X86/tailcall-largecode.ll
@@ -17,7 +17,7 @@
; Adjust the stack to enter the function. (The amount of the
; adjustment may change in the future, in which case the location of
; the stack argument and the return adjustment will change too.)
-; CHECK: subq $8, %rsp
+; CHECK: pushq
; Put the call target into R11, which won't be clobbered while restoring
; callee-saved registers and won't be used for passing arguments.
; CHECK: movq %rdi, %rax
@@ -31,7 +31,7 @@
; CHECK: movl $5, %r8d
; CHECK: movl $6, %r9d
; Adjust the stack to "return".
-; CHECK: addq $8, %rsp
+; CHECK: popq
; And tail-call to the target.
; CHECK: jmpq *%rax # TAILCALL
%res = tail call fastcc i32 %target(i32 1, i32 2, i32 3, i32 4, i32 5,
@@ -46,7 +46,7 @@
; Adjust the stack to enter the function. (The amount of the
; adjustment may change in the future, in which case the location of
; the stack argument and the return adjustment will change too.)
-; CHECK: subq $8, %rsp
+; CHECK: pushq
; Pass the stack argument.
; CHECK: movl $7, 16(%rsp)
; Pass the register arguments, in the right registers.
@@ -62,7 +62,7 @@
; arguments.
; CHECK: movabsq $manyargs_callee, %rax
; Adjust the stack to "return".
-; CHECK: addq $8, %rsp
+; CHECK: popq
; And tail-call to the target.
; CHECK: jmpq *%rax # TAILCALL
%res = tail call fastcc i32 @manyargs_callee(i32 1, i32 2, i32 3, i32 4,