[llvm-commits] [llvm] r167086 - /llvm/trunk/lib/CodeGen/MachineInstr.cpp
Akira Hatanaka
ahatanaka at mips.com
Tue Oct 30 17:50:52 PDT 2012
Author: ahatanak
Date: Tue Oct 30 19:50:52 2012
New Revision: 167086
URL: http://llvm.org/viewvc/llvm-project?rev=167086&view=rev
Log:
Check that iterator I is not the end iterator.
Modified:
llvm/trunk/lib/CodeGen/MachineInstr.cpp
Modified: llvm/trunk/lib/CodeGen/MachineInstr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineInstr.cpp?rev=167086&r1=167085&r2=167086&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineInstr.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineInstr.cpp Tue Oct 30 19:50:52 2012
@@ -1015,9 +1015,10 @@
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");
More information about the llvm-commits
mailing list