summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorTim Northover <tnorthover@apple.com>2013-12-05 11:02:02 +0000
committerTim Northover <tnorthover@apple.com>2013-12-05 11:02:02 +0000
commite4def5e2281148270cfaa89e9d1cbb66cf42680e (patch)
treed2dc2a99dda3905838ed80d4f3d98643277186c0 /llvm/lib
parent58e44a344715bfb9f6f38dedafc595a869496e4d (diff)
downloadbcm5719-llvm-e4def5e2281148270cfaa89e9d1cbb66cf42680e.tar.gz
bcm5719-llvm-e4def5e2281148270cfaa89e9d1cbb66cf42680e.zip
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. llvm-svn: 196493
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/ARM/ARMFrameLowering.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/llvm/lib/Target/ARM/ARMFrameLowering.cpp b/llvm/lib/Target/ARM/ARMFrameLowering.cpp
index 196f58dc5ee..79e5de14ddd 100644
--- a/llvm/lib/Target/ARM/ARMFrameLowering.cpp
+++ b/llvm/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.
OpenPOWER on IntegriCloud