diff options
author | Tim Northover <tnorthover@apple.com> | 2013-12-08 15:56:50 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2013-12-08 15:56:50 +0000 |
commit | 7c4342e90b929a1301261147ea23e60e1ea02f6c (patch) | |
tree | a994d2c0a8ffac6da077f3275ea7c27f20d2054f /lib | |
parent | d34102e5517685f6974e257aea3c46fb06dca299 (diff) | |
download | llvm-7c4342e90b929a1301261147ea23e60e1ea02f6c.tar.gz llvm-7c4342e90b929a1301261147ea23e60e1ea02f6c.tar.bz2 llvm-7c4342e90b929a1301261147ea23e60e1ea02f6c.tar.xz |
ARM: fix folding of stack-adjustment (yet again).
When trying to eliminate an "sub sp, sp, #N" instruction by folding
it into an existing push/pop using dummy registers, we need to account
for the fact that this might affect precisely how "fp" gets set in the
prologue.
We were attempting this, but assuming that *whenever* we performed a
fold it would make a difference. This is false, for example, in:
push {r4, r7, lr}
add fp, sp, #4
vpush {d8}
sub sp, sp, #8
we can fold the "sub" into the "vpush", forming "vpush {d7, d8}".
However, in that case the "add fp" instruction mustn't change, which
we were getting wrong before.
Should fix PR18160.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196725 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/ARM/ARMFrameLowering.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Target/ARM/ARMFrameLowering.cpp b/lib/Target/ARM/ARMFrameLowering.cpp index 79e5de14dd..ceff790685 100644 --- a/lib/Target/ARM/ARMFrameLowering.cpp +++ b/lib/Target/ARM/ARMFrameLowering.cpp @@ -256,9 +256,10 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF) const { if (NumBytes) { // Adjust SP after all the callee-save spills. - if (tryFoldSPUpdateIntoPushPop(STI, MF, LastPush, NumBytes)) - FramePtrOffsetInPush += NumBytes; - else + if (tryFoldSPUpdateIntoPushPop(STI, MF, LastPush, NumBytes)) { + if (LastPush == FramePtrPush) + FramePtrOffsetInPush += NumBytes; + } else emitSPUpdate(isARM, MBB, MBBI, dl, TII, -NumBytes, MachineInstr::FrameSetup); |