diff options
author | Tim Northover <tnorthover@apple.com> | 2013-12-05 11:02:02 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2013-12-05 11:02:02 +0000 |
commit | 52123d184232683deee6b51ab2245b186829f408 (patch) | |
tree | 1ac8edad7a5fb2b231d4a97ac0dbf17fea8abffb /lib/Target/ARM/ARMFrameLowering.cpp | |
parent | 0d668218e789b9043c122d559dcb88ea23ae4748 (diff) | |
download | llvm-52123d184232683deee6b51ab2245b186829f408.tar.gz llvm-52123d184232683deee6b51ab2245b186829f408.tar.bz2 llvm-52123d184232683deee6b51ab2245b186829f408.tar.xz |
ARM: fix yet another stack-folding bug
We were trying to fold the stack adjustment into the wrong instruction in the
situation where the entire basic-block was epilogue code. Really, it can only
ever be valid to do the folding precisely where the "add sp, ..." would be
placed so there's no need for a separate iterator to track that.
Should fix PR18136.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196493 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMFrameLowering.cpp')
-rw-r--r-- | lib/Target/ARM/ARMFrameLowering.cpp | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/Target/ARM/ARMFrameLowering.cpp b/lib/Target/ARM/ARMFrameLowering.cpp index 196f58dc5e..79e5de14dd 100644 --- a/lib/Target/ARM/ARMFrameLowering.cpp +++ b/lib/Target/ARM/ARMFrameLowering.cpp @@ -380,15 +380,10 @@ void ARMFrameLowering::emitEpilogue(MachineFunction &MF, if (NumBytes != 0) emitSPUpdate(isARM, MBB, MBBI, dl, TII, NumBytes); } else { - MachineBasicBlock::iterator FirstPop = MBBI; - // Unwind MBBI to point to first LDR / VLDRD. const uint16_t *CSRegs = RegInfo->getCalleeSavedRegs(&MF); if (MBBI != MBB.begin()) { do { - if (isPopOpcode(MBBI->getOpcode())) - FirstPop = MBBI; - --MBBI; } while (MBBI != MBB.begin() && isCSRestore(MBBI, TII, CSRegs)); if (!isCSRestore(MBBI, TII, CSRegs)) @@ -435,7 +430,7 @@ void ARMFrameLowering::emitEpilogue(MachineFunction &MF, .addReg(FramePtr)); } } else if (NumBytes && - !tryFoldSPUpdateIntoPushPop(STI, MF, FirstPop, NumBytes)) + !tryFoldSPUpdateIntoPushPop(STI, MF, MBBI, NumBytes)) emitSPUpdate(isARM, MBB, MBBI, dl, TII, NumBytes); // Increment past our save areas. |