[llvm-commits] [llvm] r151006 - /llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp

Lang Hames lhames at gmail.com
Mon Feb 20 16:00:37 PST 2012


Author: lhames
Date: Mon Feb 20 18:00:36 2012
New Revision: 151006

URL: http://llvm.org/viewvc/llvm-project?rev=151006&view=rev
Log:
Fix some bugs in HMEditor's moveAllOperandsInto logic.

Modified:
    llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp

Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=151006&r1=151005&r2=151006&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Mon Feb 20 18:00:36 2012
@@ -1025,7 +1025,7 @@
 //                         IntervalUpdate class.
 //===----------------------------------------------------------------------===//
 
-/// HMEditor is a toolkit used by handleMove to trim or extend live intervals.
+// HMEditor is a toolkit used by handleMove to trim or extend live intervals.
 class LiveIntervals::HMEditor {
 private:
   LiveIntervals& LIS;
@@ -1078,11 +1078,14 @@
 
   }
 
-  void moveAllOperandsInto(MachineInstr* MI, MachineInstr* BundleStart,
-                           SlotIndex OldIdx) {
+  void moveAllOperandsInto(MachineInstr* MI, MachineInstr* BundleStart) {
     if (MI == BundleStart)
       return; // Bundling instr with itself - nothing to do.
 
+    SlotIndex OldIdx = LIS.getSlotIndexes()->getInstructionIndex(MI);
+    assert(LIS.getSlotIndexes()->getInstructionFromIndex(OldIdx) == MI &&
+           "SlotIndex <-> Instruction mapping broken for MI");
+
     BundleRanges BR = createBundleRanges(BundleStart);
 
     RangeSet Entering, Internal, Exiting;
@@ -1201,14 +1204,14 @@
     }
 
     for (RangeSet::iterator EI = Entering.begin(), EE = Entering.end();
-         EI == EE; ++EI) {
+         EI != EE; ++EI) {
       LiveInterval* LI = EI->first;
       LiveRange* LR = EI->second;
       BR[LI->reg].Use = LR;
     }
 
     for (RangeSet::iterator II = Internal.begin(), IE = Internal.end();
-         II == IE; ++II) {
+         II != IE; ++II) {
       LiveInterval* LI = II->first;
       LiveRange* LR = II->second;
       if (LR->end.isDead()) {
@@ -1219,7 +1222,7 @@
     }
 
     for (RangeSet::iterator EI = Exiting.begin(), EE = Exiting.end();
-         EI == EE; ++EI) {
+         EI != EE; ++EI) {
       LiveInterval* LI = EI->first;
       LiveRange* LR = EI->second;
       BR[LI->reg].Def = LR;
@@ -1350,9 +1353,7 @@
     }
 
     SlotIndex LastUse = findLastUseBefore(LI->reg, OldIdx);
-    // TODO: Kill flag transfer is broken. For "Into" methods NewIdx is the
-    // bundle start, so we need another way to find MI.
-    moveKillFlags(LI->reg, NewIdx, LastUse);
+    moveKillFlags(LI->reg, OldIdx, LastUse);
 
     if (LR->start < NewIdx) {
       // Becoming a new entering range.





More information about the llvm-commits mailing list