diff options
author | Akira Hatanaka <ahatanaka@mips.com> | 2012-10-31 00:50:52 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@mips.com> | 2012-10-31 00:50:52 +0000 |
commit | dc6d846df56f83be4c7045ccc9092f8a8343360b (patch) | |
tree | ae4385b6229a04789c47fb256803a07acacf58f8 /lib/CodeGen | |
parent | 3a9b71434cda6f66d65a031effec1bbe58e1dda3 (diff) |
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')
-rw-r--r-- | lib/CodeGen/MachineInstr.cpp | 5 |
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"); |