diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-08-17 00:53:04 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-08-17 00:53:04 +0000 |
commit | ec083b59edf0cbf0855527c753d9053bcdba33da (patch) | |
tree | 560673c49c9910d65694ad91ffa22efbdab30f4d /llvm/lib/Target/ARM/ARMFrameLowering.cpp | |
parent | 00ec93da2655a42195dd3864104bf335ed11c73f (diff) | |
download | llvm-ec083b59edf0cbf0855527c753d9053bcdba33da.zip llvm-ec083b59edf0cbf0855527c753d9053bcdba33da.tar.gz llvm-ec083b59edf0cbf0855527c753d9053bcdba33da.tar.bz2 |
ARM: Avoid dereferencing end() in ARMFrameLowering::emitPrologue
llvm::tryFoldSPUpdateIntoPushPop assumes its arguments are valid
MachineInstrs. Update ARMFrameLowering::emitPrologue to respect that;
when LastPush==end(), it can't possibly be a push instruction anyway.
llvm-svn: 278880
Diffstat (limited to 'llvm/lib/Target/ARM/ARMFrameLowering.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMFrameLowering.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMFrameLowering.cpp b/llvm/lib/Target/ARM/ARMFrameLowering.cpp index 8535075..0540745 100644 --- a/llvm/lib/Target/ARM/ARMFrameLowering.cpp +++ b/llvm/lib/Target/ARM/ARMFrameLowering.cpp @@ -413,7 +413,8 @@ void ARMFrameLowering::emitPrologue(MachineFunction &MF, // .cfi_offset operations will reflect that. if (DPRGapSize) { assert(DPRGapSize == 4 && "unexpected alignment requirements for DPRs"); - if (tryFoldSPUpdateIntoPushPop(STI, MF, &*LastPush, DPRGapSize)) + if (LastPush != MBB.end() && + tryFoldSPUpdateIntoPushPop(STI, MF, &*LastPush, DPRGapSize)) DefCFAOffsetCandidates.addExtraBytes(LastPush, DPRGapSize); else { emitSPUpdate(isARM, MBB, MBBI, dl, TII, -DPRGapSize, |