Fix a crash in the pre-alloc splitter exposed by recent codegen changes.

llvm-svn: 65121
diff --git a/llvm/lib/CodeGen/PreAllocSplitting.cpp b/llvm/lib/CodeGen/PreAllocSplitting.cpp
index ef2cfdb..9e955bd 100644
--- a/llvm/lib/CodeGen/PreAllocSplitting.cpp
+++ b/llvm/lib/CodeGen/PreAllocSplitting.cpp
@@ -224,6 +224,9 @@
   if (RefsInMBB.empty() && !DefMI) {
     MachineBasicBlock::iterator MII = MBB->begin();
     MachineBasicBlock::iterator EndPt = MI;
+    
+    if (MII == EndPt) return Pt;
+    
     do {
       ++MII;
       unsigned Index = LIs->getInstructionIndex(MII);
@@ -303,6 +306,9 @@
   if (RefsInMBB.empty() && LastIdx >= EndIdx) {
     MachineBasicBlock::iterator MII = MBB->getFirstTerminator();
     MachineBasicBlock::iterator EndPt = MI;
+    
+    if (MII == EndPt) return Pt;
+    
     --MII;
     do {
       unsigned Index = LIs->getInstructionIndex(MII);