[llvm] r174936 - Add blocks to the LiveIntervalAnalysis RegMaskBlocks array when splitting

Cameron Zwarich zwarich at apple.com
Mon Feb 11 19:49:20 PST 2013


Author: zwarich
Date: Mon Feb 11 21:49:20 2013
New Revision: 174936

URL: http://llvm.org/viewvc/llvm-project?rev=174936&view=rev
Log:
Add blocks to the LiveIntervalAnalysis RegMaskBlocks array when splitting
a critical edge.

Modified:
    llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
    llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp

Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=174936&r1=174935&r2=174936&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Mon Feb 11 21:49:20 2013
@@ -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);
     }

Modified: llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp?rev=174936&r1=174935&r2=174936&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineBasicBlock.cpp Mon Feb 11 21:49:20 2013
@@ -664,8 +664,12 @@ MachineBasicBlock::SplitCriticalEdge(Mac
         " 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(Mac
     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





More information about the llvm-commits mailing list