summaryrefslogtreecommitdiffstats
path: root/llvm/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
commitebb31e9c42241905b17599db7ce2d1bbe102a356 (patch)
treef570a8be11151506a58a492692b0a428084e6991 /llvm/lib/CodeGen/MachineInstr.cpp
parentc14b96898ab403b3b3f3c8abe3610c5518c280f6 (diff)
downloadbcm5719-llvm-ebb31e9c42241905b17599db7ce2d1bbe102a356.tar.gz
bcm5719-llvm-ebb31e9c42241905b17599db7ce2d1bbe102a356.zip
Check that iterator I is not the end iterator.
llvm-svn: 167086
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineInstr.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index e8885761db2..ce8d52000b4 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/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");
OpenPOWER on IntegriCloud