summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2011-02-22 07:07:59 +0000
committerEvan Cheng <evan.cheng@apple.com>2011-02-22 07:07:59 +0000
commit666cf56668e5be83c4e8424c188f727a6b852312 (patch)
tree47235078ed30958772ea89f389d209aa2e4aa40a /llvm/lib/Target
parent2ce663031f9846e5a001b7fd9135d72a328bb98d (diff)
downloadbcm5719-llvm-666cf56668e5be83c4e8424c188f727a6b852312.tar.gz
bcm5719-llvm-666cf56668e5be83c4e8424c188f727a6b852312.zip
Guard against de-referencing MBB.end().
llvm-svn: 126192
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/ARM/Thumb2InstrInfo.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp b/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
index 836c1baffd4..9b1073be3c8 100644
--- a/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
+++ b/llvm/lib/Target/ARM/Thumb2InstrInfo.cpp
@@ -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;
OpenPOWER on IntegriCloud