[AArch64] Break the dependency between FP and SP when possible.
When the SP in not changed because of realignment/VLAs etc., we restore the SP
by using the previous value of SP and not the FP. Breaking the dependency will
help in cases when the epilog of a callee is close to the epilog of the caller;
for then "sub sp, fp, #" depends on the load restoring the FP in the epilog of
the callee.
http://reviews.llvm.org/D18060
Patch by Aditya Kumar and Evandro Menezes.
llvm-svn: 263458
diff --git a/llvm/test/CodeGen/AArch64/fastcc.ll b/llvm/test/CodeGen/AArch64/fastcc.ll
index 8a34572..c23d91e 100644
--- a/llvm/test/CodeGen/AArch64/fastcc.ll
+++ b/llvm/test/CodeGen/AArch64/fastcc.ll
@@ -42,12 +42,12 @@
; CHECK-TAIL-NOT: sub sp, sp
ret void
-; CHECK: mov sp, x29
+; CHECK: add sp, sp, #32
; CHECK-NEXT: ldp x29, x30, [sp], #16
; CHECK-NEXT: ret
-; CHECK-TAIL: mov sp, x29
+; CHECK-TAIL: add sp, sp, #32
; CHECK-TAIL-NEXT: ldp x29, x30, [sp], #16
; CHECK-TAIL-NEXT: ret
}
@@ -91,12 +91,12 @@
; CHECK-TAIL-NOT: sub sp, sp
ret void
-; CHECK: mov sp, x29
+; CHECK: add sp, sp, #32
; CHECK-NEXT: ldp x29, x30, [sp], #16
; CHECK-NEXT: ret
-; CHECK-TAIL: mov sp, x29
+; CHECK-TAIL: add sp, sp, #32
; CHECK-TAIL-NEXT: ldp x29, x30, [sp], #16
; CHECK-TAIL-NEXT: add sp, sp, #16
; CHECK-TAIL-NEXT: ret
@@ -136,11 +136,11 @@
; CHECK-TAIL-NOT: sub sp, sp
ret void
-; CHECK: mov sp, x29
+; CHECK: add sp, sp, #32
; CHECK-NEXT: ldp x29, x30, [sp], #16
; CHECK-NEXT: ret
-; CHECK-TAIL: mov sp, x29
+; CHECK-TAIL: add sp, sp, #32
; CHECK-TAIL-NEXT: ldp x29, x30, [sp], #16
; CHECK-TAIL-NEXT: add sp, sp, #32
; CHECK-TAIL-NEXT: ret