Avoid finalizeBundles infinite looping.
authorEvan Cheng <evan.cheng@apple.com>
Tue, 6 Mar 2012 02:00:52 +0000 (02:00 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Tue, 6 Mar 2012 02:00:52 +0000 (02:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152089 91177308-0d34-0410-b5e6-96231b3b80d8

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;