[AArch64] Use FP to access the emergency spill slot
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>
Tue, 10 Apr 2018 11:29:40 +0000 (11:29 +0000)
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>
Tue, 10 Apr 2018 11:29:40 +0000 (11:29 +0000)
commitf2c22050e8211f2c768e9ff2bb50c902ec8ac078
tree65d2acf0c967f2a991afb2d3de911eccb18e5e40
parent7190a4692ac65c9a5decaf62d403d68ac094dd0c
[AArch64] Use FP to access the emergency spill slot

In the presence of variable-sized stack objects, we always picked the
base pointer when resolving frame indices if it was available.

This makes us hit an assert where we can't reach the emergency spill
slot if it's too far away from the base pointer. Since on AArch64 we
decide to place the emergency spill slot at the top of the frame, it
makes more sense to use FP to access it.

The changes here don't affect only emergency spill slots but all the
frame indices. The goal here is to try to choose between FP, BP and SP
so that we minimize the offset and avoid scavenging, or worse, asserting
when trying to access a slot allocated by the scavenger.

Previously discussed here: https://reviews.llvm.org/D40876.

Differential Revision: https://reviews.llvm.org/D45358

llvm-svn: 329691
llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
llvm/test/CodeGen/AArch64/arm64-alloca-frame-pointer-offset.ll
llvm/test/CodeGen/AArch64/unreachable-emergency-spill-slot.mir [new file with mode: 0644]