Another bug fix for empty MBB's
authorChris Lattner <sabre@nondot.org>
Sun, 22 Feb 2004 19:37:31 +0000 (19:37 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 22 Feb 2004 19:37:31 +0000 (19:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11716 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/RegAllocLocal.cpp

index 23063461d70505a3115cf9255c992b28e1673a08..38e00733602c46c7469baac083c8036bf7f18e38 100644 (file)
@@ -653,7 +653,7 @@ void RA::AllocateBasicBlock(MachineBasicBlock &MBB) {
   const TargetInstrInfo &TII = TM->getInstrInfo();
   MI = MBB.end();
   while (MI != MBB.begin() && TII.isTerminatorInstr((--MI)->getOpcode()));
-  ++MI;
+  if (MI != MBB.end()) ++MI;
 
   // Spill all physical registers holding virtual registers now.
   for (unsigned i = 0, e = RegInfo->getNumRegs(); i != e; ++i)