diff options
author | Tim Northover <tnorthover@apple.com> | 2014-01-14 22:53:28 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2014-01-14 22:53:28 +0000 |
commit | 463a5f24d15347ab7a605a0ac7dda21bd01a1850 (patch) | |
tree | e9501572d46ce3c1655bada9370856eadf6ecf8d /llvm/lib/Target/ARM/Thumb1FrameLowering.cpp | |
parent | 6e219cd588a3df41ce31fb895d007bb42f8cdf40 (diff) | |
download | llvm-463a5f24d15347ab7a605a0ac7dda21bd01a1850.zip llvm-463a5f24d15347ab7a605a0ac7dda21bd01a1850.tar.gz llvm-463a5f24d15347ab7a605a0ac7dda21bd01a1850.tar.bz2 |
ARM: correctly determine final tBX_LR in Thumb1 functions
The changes caused by folding an sp-adjustment into a "pop" previously
disrupted the forward search for the final real instruction in a
terminating block. This switches to a backward search (skipping debug
instrs).
This fixes PR18399.
Patch by Zhaoshi.
llvm-svn: 199266
Diffstat (limited to 'llvm/lib/Target/ARM/Thumb1FrameLowering.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/Thumb1FrameLowering.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Target/ARM/Thumb1FrameLowering.cpp b/llvm/lib/Target/ARM/Thumb1FrameLowering.cpp index d8546da..2a587dd 100644 --- a/llvm/lib/Target/ARM/Thumb1FrameLowering.cpp +++ b/llvm/lib/Target/ARM/Thumb1FrameLowering.cpp @@ -304,9 +304,9 @@ void Thumb1FrameLowering::emitEpilogue(MachineFunction &MF, // we need to update the SP after popping the value. Therefore, we // pop the old LR into R3 as a temporary. - // Move back past the callee-saved register restoration - while (MBBI != MBB.end() && isCSRestore(MBBI, CSRegs)) - ++MBBI; + // Get the last instruction, tBX_RET + MBBI = MBB.getLastNonDebugInstr(); + assert (MBBI->getOpcode() == ARM::tBX_RET); // Epilogue for vararg functions: pop LR to R3 and branch off it. AddDefaultPred(BuildMI(MBB, MBBI, dl, TII.get(ARM::tPOP))) .addReg(ARM::R3, RegState::Define); |