ARM: Avoid dereferencing end() in ARMFrameLowering::emitEpilogue
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sun, 21 Aug 2016 00:08:10 +0000 (00:08 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Sun, 21 Aug 2016 00:08:10 +0000 (00:08 +0000)
commit8f44c98d046a22348504ff11e048753edbeea086
treef67a664ab69d51eea6d1aa99b0361ead12347deb
parent3b40aa57f619771d7e4f5b5267a57c7f8a416bea
ARM: Avoid dereferencing end() in ARMFrameLowering::emitEpilogue

This fixes the crash from PR29072, where the MachineBasicBlock::iterator
wasn't being properly checked against MachineBasicBlock::end() before
iterating.  This was another bug exposed by the new
ilist::iterator::operator*() assertion from r279314.

This testcase is poor quality.  bugpoint couldn't reduce any further,
and I haven't had time to dig into what's going on so I can't invent a
better one.  I didn't even get good CHECK lines in: this is just a
crasher.

I'm committing anyway since this is a real crash with an obvious fix,
but I'll leave PR29072 open and ask an ARM maintainer to help improve
the testcase.

llvm-svn: 279391
llvm/lib/Target/ARM/ARMFrameLowering.cpp
llvm/test/CodeGen/ARM/arm-frame-lowering-no-terminator.ll [new file with mode: 0644]