Guard against de-referencing MBB.end().

llvm-svn: 126192
This commit is contained in:
Evan Cheng 2011-02-22 07:07:59 +00:00
parent 2ce663031f
commit 666cf56668
1 changed files with 4 additions and 1 deletions

View File

@ -95,8 +95,11 @@ Thumb2InstrInfo::ReplaceTailWithBranchTo(MachineBasicBlock::iterator Tail,
bool
Thumb2InstrInfo::isLegalToSplitMBBAt(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MBBI) const {
while (MBBI->isDebugValue())
while (MBBI->isDebugValue()) {
++MBBI;
if (MBBI == MBB.end())
return false;
}
unsigned PredReg = 0;
return llvm::getITInstrPredicate(MBBI, PredReg) == ARMCC::AL;