Undo spill weight tweak. Need to investigate the performance regressions.
[oota-llvm.git] / lib / CodeGen / LiveIntervalAnalysis.cpp
index 37e3895b3c450126ad433fbc6cfc06c1555c0b22..83df4d174a4cb0b0b5129fd8fa0dac2c1085a577 100644 (file)
@@ -100,11 +100,14 @@ void LiveIntervals::computeNumbering() {
       i2miMap_.push_back(I);
       MIIndex += InstrSlots::NUM;
     }
-
+    
+    if (StartIdx == MIIndex) {
+      // Empty MBB
+      MIIndex += InstrSlots::NUM;
+      i2miMap_.push_back(0);
+    }
     // Set the MBB2IdxMap entry for this MBB.
-    MBB2IdxMap[MBB->getNumber()] = (StartIdx == MIIndex)
-      ? std::make_pair(StartIdx, StartIdx)  // Empty MBB
-      : std::make_pair(StartIdx, MIIndex - 1);
+    MBB2IdxMap[MBB->getNumber()] = std::make_pair(StartIdx, MIIndex - 1);
     Idx2MBBMap.push_back(std::make_pair(StartIdx, MBB));
   }
   std::sort(Idx2MBBMap.begin(), Idx2MBBMap.end(), Idx2MBBCompare());
@@ -362,14 +365,11 @@ void LiveIntervals::handleVirtualRegisterDef(MachineBasicBlock *mbb,
     // live interval.
     for (unsigned i = 0, e = vi.AliveBlocks.size(); i != e; ++i) {
       if (vi.AliveBlocks[i]) {
-        MachineBasicBlock *MBB = mf_->getBlockNumbered(i);
-        if (!MBB->empty()) {
-          LiveRange LR(getMBBStartIdx(i),
-                       getInstructionIndex(&MBB->back()) + InstrSlots::NUM,
-                       ValNo);
-          interval.addRange(LR);
-          DOUT << " +" << LR;
-        }
+        LiveRange LR(getMBBStartIdx(i),
+                     getMBBEndIdx(i)+1,  // MBB ends at -1.
+                     ValNo);
+        interval.addRange(LR);
+        DOUT << " +" << LR;
       }
     }
 
@@ -661,6 +661,8 @@ void LiveIntervals::computeIntervals() {
       
       MIIndex += InstrSlots::NUM;
     }
+    
+    if (MBB->begin() == miEnd) MIIndex += InstrSlots::NUM; // Empty MBB
   }
 }