summaryrefslogtreecommitdiff
path: root/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorAkira Hatanaka <ahatanaka@mips.com>2012-10-31 00:50:52 +0000
committerAkira Hatanaka <ahatanaka@mips.com>2012-10-31 00:50:52 +0000
commitdc6d846df56f83be4c7045ccc9092f8a8343360b (patch)
treeae4385b6229a04789c47fb256803a07acacf58f8 /lib/CodeGen/MachineInstr.cpp
parent3a9b71434cda6f66d65a031effec1bbe58e1dda3 (diff)
downloadllvm-dc6d846df56f83be4c7045ccc9092f8a8343360b.tar.gz
llvm-dc6d846df56f83be4c7045ccc9092f8a8343360b.tar.bz2
llvm-dc6d846df56f83be4c7045ccc9092f8a8343360b.tar.xz
Check that iterator I is not the end iterator.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167086 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineInstr.cpp')
-rw-r--r--lib/CodeGen/MachineInstr.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp
index e8885761db..ce8d52000b 100644
--- a/lib/CodeGen/MachineInstr.cpp
+++ b/lib/CodeGen/MachineInstr.cpp
@@ -1015,9 +1015,10 @@ MachineInstr::getRegClassConstraint(unsigned OpIdx,
unsigned MachineInstr::getBundleSize() const {
assert(isBundle() && "Expecting a bundle");
- MachineBasicBlock::const_instr_iterator I = *this;
+ const MachineBasicBlock *MBB = getParent();
+ MachineBasicBlock::const_instr_iterator I = *this, E = MBB->instr_end();
unsigned Size = 0;
- while ((++I)->isInsideBundle()) {
+ while ((++I != E) && I->isInsideBundle()) {
++Size;
}
assert(Size > 1 && "Malformed bundle");