Add blocks to the LiveIntervalAnalysis RegMaskBlocks array when splitting
authorCameron Zwarich <zwarich@apple.com>
Tue, 12 Feb 2013 03:49:20 +0000 (03:49 +0000)
committerCameron Zwarich <zwarich@apple.com>
Tue, 12 Feb 2013 03:49:20 +0000 (03:49 +0000)
a critical edge.

llvm-svn: 174936

llvm/include/llvm/CodeGen/LiveIntervalAnalysis.h
llvm/lib/CodeGen/MachineBasicBlock.cpp

index 3c6a2be..b6cc111 100644 (file)
@@ -214,6 +214,13 @@ namespace llvm {
       return Indexes->getMBBFromIndex(index);
     }
 
+    void insertMBBInMaps(MachineBasicBlock *MBB) {
+      Indexes->insertMBBInMaps(MBB);
+      assert(unsigned(MBB->getNumber()) == RegMaskBlocks.size() &&
+             "Blocks must be added in order.");
+      RegMaskBlocks.push_back(std::make_pair(MBB->getNumber(), 0));
+    }
+
     SlotIndex InsertMachineInstrInMaps(MachineInstr *MI) {
       return Indexes->insertMachineInstrInMaps(MI);
     }
index 71d59f0..df1c7c2 100644 (file)
@@ -664,8 +664,12 @@ MachineBasicBlock::SplitCriticalEdge(MachineBasicBlock *Succ, Pass *P) {
         " BB#" << getNumber()
         << " -- BB#" << NMBB->getNumber()
         << " -- BB#" << Succ->getNumber() << '\n');
+
+  LiveIntervals *LIS = P->getAnalysisIfAvailable<LiveIntervals>();
   SlotIndexes *Indexes = P->getAnalysisIfAvailable<SlotIndexes>();
-  if (Indexes)
+  if (LIS)
+    LIS->insertMBBInMaps(NMBB);
+  else if (Indexes)
     Indexes->insertMBBInMaps(NMBB);
 
   // On some targets like Mips, branches may kill virtual registers. Make sure
@@ -771,7 +775,7 @@ MachineBasicBlock::SplitCriticalEdge(MachineBasicBlock *Succ, Pass *P) {
     LV->addNewBlock(NMBB, this, Succ);
   }
 
-  if (LiveIntervals *LIS = P->getAnalysisIfAvailable<LiveIntervals>()) {
+  if (LIS) {
     // After splitting the edge and updating SlotIndexes, live intervals may be
     // in one of two situations, depending on whether this block was the last in
     // the function. If the original block was the last in the function, all live