Empty basic block should have an empty range.
authorEvan Cheng <evan.cheng@apple.com>
Wed, 16 Apr 2008 18:01:08 +0000 (18:01 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Wed, 16 Apr 2008 18:01:08 +0000 (18:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49800 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/LiveIntervalAnalysis.cpp

index 9f72035bc90572ffdd598af2df1eff934bae8c80..d8ca141c6693da14588111428013878e16f10381 100644 (file)
@@ -108,7 +108,9 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
     }
 
     // Set the MBB2IdxMap entry for this MBB.
-    MBB2IdxMap[MBB->getNumber()] = std::make_pair(StartIdx, MIIndex - 1);
+    MBB2IdxMap[MBB->getNumber()] = (StartIdx == MIIndex)
+      ? std::make_pair(StartIdx, StartIdx)  // Empty MBB
+      : std::make_pair(StartIdx, MIIndex - 1);
     Idx2MBBMap.push_back(std::make_pair(StartIdx, MBB));
   }
   std::sort(Idx2MBBMap.begin(), Idx2MBBMap.end(), Idx2MBBCompare());