[llvm] r278880 - ARM: Avoid dereferencing end() in ARMFrameLowering::emitPrologue
Duncan P. N. Exon Smith via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 16 17:53:04 PDT 2016
Author: dexonsmith
Date: Tue Aug 16 19:53:04 2016
New Revision: 278880
URL: http://llvm.org/viewvc/llvm-project?rev=278880&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp
Modified: llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp?rev=278880&r1=278879&r2=278880&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMFrameLowering.cpp Tue Aug 16 19:53:04 2016
@@ -413,7 +413,8 @@ void ARMFrameLowering::emitPrologue(Mach
// .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,
More information about the llvm-commits
mailing list