Avoid finalizeBundles infinite looping.
[oota-llvm.git] / lib / CodeGen / MachineInstrBundle.cpp
index d1f2df94b5b906778f2a15e9217152b2e93ef748..73489a7160bf3949623a3062279d12e08c08b3c1 100644 (file)
@@ -229,6 +229,8 @@ bool llvm::finalizeBundles(MachineFunction &MF) {
            "First instr cannot be inside bundle before finalization!");
 
     MachineBasicBlock::instr_iterator MIE = MBB.instr_end();
+    if (MII == MIE)
+      continue;
     for (++MII; MII != MIE; ) {
       if (!MII->isInsideBundle())
         ++MII;