ARM: fix folding of stack-adjustment (yet again).
authorTim Northover <tnorthover@apple.com>
Sun, 8 Dec 2013 15:56:50 +0000 (15:56 +0000)
committerTim Northover <tnorthover@apple.com>
Sun, 8 Dec 2013 15:56:50 +0000 (15:56 +0000)
commit7c4342e90b929a1301261147ea23e60e1ea02f6c
treea994d2c0a8ffac6da077f3275ea7c27f20d2054f
parentd34102e5517685f6974e257aea3c46fb06dca299
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
lib/Target/ARM/ARMFrameLowering.cpp
test/CodeGen/ARM/fold-stack-adjust.ll