From c1dc78de762e8a65fe1edd0cced13d94ab5a971f Mon Sep 17 00:00:00 2001 From: Jim Grosbach Date: Tue, 31 Aug 2010 18:52:31 +0000 Subject: [PATCH] SP relative offsets need to be adjusted by the local allocation size when determining if they're likely to be in range of the SP when resolving frame references. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112624 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/ARMBaseRegisterInfo.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Target/ARM/ARMBaseRegisterInfo.cpp b/lib/Target/ARM/ARMBaseRegisterInfo.cpp index e692988fd52..07c890de5cc 100644 --- a/lib/Target/ARM/ARMBaseRegisterInfo.cpp +++ b/lib/Target/ARM/ARMBaseRegisterInfo.cpp @@ -1480,7 +1480,11 @@ needsFrameBaseReg(MachineInstr *MI, int64_t Offset) const { if (!AFI->isThumbFunction() || !AFI->isThumb1OnlyFunction()) FPOffset -= 80; // Estimate an offset from the stack pointer. + // The incoming offset is relating to the SP at the start of the function, + // but when we access the local it'll be relative to the SP after local + // allocation, so adjust our SP-relative offset by that allocation size. Offset = -Offset; + Offset += MFI->getLocalFrameSize(); // Assume that we'll have at least some spill slots allocated. // FIXME: This is a total SWAG number. We should run some statistics // and pick a real one.